在Brunch中分离app和vendor css

ken*_*ken 9 brunch

My Brunch模板将我的所有代码编译成app.js所有第三方依赖项vendor.js(一种非常标准的方法).我想用CSS做同样的事情它曾经工作,但当我转向使用Bower时,一些东西停止工作,我现在得到以下错误:

错误:无法加载config /path-to-root/config.coffee.SyntaxError:unexpected {at Object.exports.loadConfig(/usr/local/share/npm/lib/node_modules/brunch/lib/helpers.js:448:15)

从配置文件(config.cofee)看起来像这样:

files:
    javascripts:
      joinTo: 
        'javascripts/app.js': /^app/
        'javascripts/vendor.js': /^(bower_components|vendor)/
        'test/javascripts/test-vendor.js': /^test(\/|\\)(?=vendor)/

    stylesheets:
      joinTo:
        'stylesheets/app.css': /^app/
        'stylesheets/vendor.css': /^(bower_components|vendor)/
Run Code Online (Sandbox Code Playgroud)

如果我只是去掉样式表的两行并将这一行放在它的位置它可以正常工作:

'stylesheets/vendor.css':/ ^(app | bower_components | vendor)/

我一直与此生活在一起,但这导致了越来越多的问题,我想让它排序.任何帮助将不胜感激.

如果问题出现......我正在使用的早午餐版本是1.7.6.

ken*_*ken 4

我很困惑,但我认为保罗关于也许一个特殊角色已进入文件的建议似乎是有可能的。我现在让它使用的配置看起来与之前不工作的配置相同。这是完整的配置文件:

sysPath = require 'path'

exports.config =
  # See http://brunch.io/#documentation for documentation.
  files:
    javascripts:
      joinTo:
        'javascripts/app.js': /^app/
        'javascripts/vendor.js': /^(bower_components|vendor)/
        'test/javascripts/test-vendor.js': /^test(\/|\\)(?=vendor)/

    stylesheets:
      joinTo: 
        'stylesheets/app.css': /^app/
        'stylesheets/vendor.css': /^(bower_components|vendor)/

    templates:
      precompile: true
      root: 'templates'
      joinTo: 'javascripts/app.js' : /^app/

      modules:
        addSourceURLs: true

  # allow _ prefixed templates so partials work
  conventions:
    ignored: (path) ->
      startsWith = (string, substring) ->
        string.indexOf(substring, 0) is 0
      sep = sysPath.sep
      if path.indexOf("app#{sep}templates#{sep}") is 0
        false
      else
        startsWith sysPath.basename(path), '_'
Run Code Online (Sandbox Code Playgroud)