Go语言构建器/任务运行器

huangapple go评论92阅读模式
英文:

Go lang builder / task runner

问题

我正在创建一个小型的SPA框架(可能是一个完整的功能框架)。
前端基于原生JavaScript(包括ES6特性和Web组件)。
后端使用Go语言编写。

以下是我想要自动完成的需求列表:

  1. 压缩我的JavaScript文件。

  2. 将ES6代码转译为ES5(使用类似babel.js的工具)。

  3. 对我的Web组件进行Polyfill。

有没有一种方法可以在不使用Node.js的情况下实现这些需求?是否已经有Go语言的包可以以一种“简单”的grunt/gulp方式实现这三个功能?

我希望避免安装Node.js、npm、bower等工具。
在我(不是非常机密的)意见中,使用这些Node.js工具会使我的应用程序变得混乱,给应用程序文件夹增加了很多不必要的开销,并且使我的框架依赖于很多东西(应用程序员必须学习、理解和知道如何使用)。

谢谢任何提示/意见。

英文:

I'm creating a little SPA framework (might be a full-feature framework).
Frontend is based on native javascript (including ES6 features and web-components).
Backend is written in Go.

Here is a list of my needs, that I'd like to do automatically:

  1. Minify my javascript files

  2. Transpile ES6 code to ES5 (with something like babel.js)

  3. Polyfill my web-components

Is there a way to achieve this without using node.js? Are there already go packages that can make those 3 things happen, with a "simple" grunt/gulp-like way?

I would like to avoid installing node.js, npm, bower... etc.
In my (not very classified) oppinion, using those node.js tools makes my application a mess adding a lot of unnecessery overhead to my application folder and makes my framework dependant on a lot of stuff (that application programmer has to learn, understand and know how to use).

Thanks for any tips/oppinions.

答案1

得分: 0

如果你正在做一个单页应用程序(SPA),你应该坚持使用gulp等工具。你可能最终会使用像browserify、autoprefix等npm工具,基本上你会自己重新发明一个资产管道。

话虽如此,我之前看过几个,但它们看起来都不太成熟:
https://github.com/jbowens/assets

https://github.com/shaoshing/train

而且无论如何你都需要安装npm来使用它们。

英文:

If you're doing a SPA you should just stick with gulp and others. You'll probably end up using npm stuff like browserify, autoprefix, etc, and you'll basically end up reinventing the wheel with your own asset pipeline.

With that said I've seen a couple, but none of them looked very mature last time I looked:
https://github.com/jbowens/assets

https://github.com/shaoshing/train

and you're going to need npm installed to use them regardless.

huangapple
  • 本文由 发表于 2016年1月31日 01:12:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/35104582.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定