【问题标题】:Using yeoman with triggerio将 yeoman 与 triggerio 一起使用
【发布时间】:2013-01-31 13:52:27
【问题描述】:

我正在尝试将 trigger.io 与 yeoman 一起使用。 我在整个构建周期中使用 yeoman(脚手架 angularjs 应用程序/测试/..) 和 trigger.io 进行部署。
Trigger.io 在 'src' 和 yeoman 都在 'app' 目录中生成所有内容。

有没有办法让 Trigger.io 写入“app”而不是“src”目录?

编辑这似乎可行,但不太可行,因为它需要跟踪 yeoman 生成的新目录/文件:

  • ln -s app/index.html index.html
  • ln -s 应用/样式样式
  • ln -s app/scripts 脚本
  • :继续做任何相关的事情

【问题讨论】:

    标签: trigger.io yeoman


    【解决方案1】:

    我最终将dist 符号链接到src,因为我们需要 Yeoman 来编译 SCSS 和 CoffeScript 文件。当你yeoman build 创建dist 目录时,这里的无赖是yeoman server 无法运行。另外 bummerish 是当你再次yeoman server 时,它会清理dist 目录。

    我计划为 Trigger 的生成器创建一个 yeoman 生成器,并添加一些模仿我在使用 Sinatra 测试和开发时创建的 Rakefile 任务的任务(例如 yeoman simulatoryeoman device、@ 987654332@).

    编辑:我现在已经直接向我的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
        }
      }
    },
    

    我将这些任务添加到适当的监视命令中,并添加了一个新监视来监视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 server 调用yeoman watch,使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 目录保存在可以签入的位置。

    最终我会将它移到一个 yeoman 插件中,并添加一些更具体的构建任务来清理适当目标(例如 iOS、Android)的 src 目录,以保持目录大小较小。

    编辑:我创建了 grunt-forge 来帮助在 Yeoman 内部运行 forge。我还写了一些关于创建 a more terse output for `forge 的博客。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-13
      • 2015-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多