我正在尝试将 trigger.io 与 yeoman 一起使用。
我在整个构建周期中使用 yeoman(脚手架 angularjs 应用程序/测试/..)
和 trigger.io 用于部署。
Trigger.io 在“src”中生成所有内容,在“app”目录中生成 yeoman。
有没有办法让 Trigger.io 写入“app”而不是“src”目录?
编辑 这似乎可行但不太可行,因为它需要跟踪由 yeoman 生成的新目录/文件:
- ln -s app/index.html index.html
- ln -s app/styles 风格
- ln -s app/scripts 脚本
- :继续做任何相关的事情
最佳答案
我最终将 dist
符号链接(symbolic link)到 src
因为我们需要 Yeoman 来编译 SCSS 和 CoffeScript 文件。令人遗憾的是,当您使用 yeoman build
创建 dist
目录时,yeoman server
无法运行。此外 bummerish 是当您再次 yeoman 服务器
时,它会清理 dist
目录。
我计划为 Trigger 的生成器创建一个 yeoman 生成器,并添加一些模仿 Rakefile
任务的 grunt 任务,这些任务是我在使用 Sinatra 进行测试和开发时创建的(例如 yeoman模拟器
, yeoman device
, yeoman testflight
).
编辑:目前我已经将一些任务直接添加到我的 gruntfile.js
中。我添加了 grunt-contrib-copy
并添加了以下子任务。
copy: {
app: {
files: {
"src/": "app/**", // core app files
},
},
compass: {
files: {
"src/styles/": "temp/styles/**", // drop in the compiled coffeescript
}
},
coffee: {
files: {
"src/scripts/": "temp/scripts/**" // drop in the compiled scss
}
}
},
我将这些任务添加到适当的 watch 命令,并添加了一个新 watch 来 watch app
目录。
watch: {
coffee: {
files: 'app/scripts/**/*.coffee',
tasks: 'coffee copy:coffee reload'
},
compass: {
files: [
'app/styles/**/*.{scss,sass}'
],
tasks: 'compass copy:compass reload'
},
app: {
files: [
'app/**/*.{html,png,json,css,js}'
],
tasks: 'copy:app'
},
}
现在调用 yeoman watch
的 yeoman server
使 src
保持最新。
我还引入了 grunt-shell
来执行以下操作。
shell: {
forge_build: {
command: 'forge build ios 2>&1 | tee output',
stdout: true
},
forge_run_device: {
command: 'forge run ios --ios.device device',
stdout: true
},
forge_run: {
command: 'forge run ios',
stdout: true
}
}
并创建一些任务,例如:
grunt.registerTask("sim", 'copy shell:forge_build shell:forge_run');
grunt.registerTask("device", 'copy shell:forge_build shell:forge_run_device');
我对它不是很满意,但它让我可以继续运行 yeoman server
并转到别处的控制台并运行 yeoman device
以将其显示在设备。它还将 src
目录保存在可以 checkin 的地方。
最终我会将其移至 yeoman 插件并添加一些更具体的构建任务以清理适当目标(例如 iOS、Android)的 src 目录以保持目录大小较小。
编辑:我创建了 grunt-forge
来帮助从 Yeoman 内部运行 forge
。我还在博客上写了一些关于创建 a more terse output for `forge 的内容.
关于trigger.io - 将 yeoman 与 triggerio 结合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14627392/