我正在尝试让 broccolijs 使用 broccoli-less 编译更少文件的目录。我已将“预处理”功能更改如下:
var compileLess = require('broccoli-less')
var pickFiles = require('broccoli-static-compiler')
function preprocess (tree) {
tree = filterTemplates(tree, {
extensions: ['hbs', 'handlebars'],
compileFunction: 'Ember.Handlebars.compile'
})
tree = filterCoffeeScript(tree, {
bare: true
})
tree = compileLess(tree, {
compress: false,
})
return tree
}
在我的项目文件夹中,我有一个名为“less”的目录,我将其包含在 Brocfile.js 中:
var lessStyles = 'less'
lessStyles = pickFiles(lessStyles, {
srcDir: '/',
files: ['main.less'],
destDir: 'appkit'
})
lessStyles = preprocess(lessStyles)
var sourceTrees = [app, styles, vendor, lessStyles]
if (env !== 'production') {
sourceTrees.push(tests)
}
sourceTrees = sourceTrees.concat(findBowerTrees())
尝试构建此项目会产生错误:
$ broccoli serve
Serving on http://localhost:4200
path.js:360
throw new TypeError('Arguments to path.join must be strings');
^
TypeError: Arguments to path.join must be strings
at path.js:360:15
at Array.filter (native)
at Object.exports.join (path.js:358:36)
at tryPathIndex (/home/kyrre/beekeeper-frontend/node_modules/broccoli-less/node_modules/less/lib/less/index.js:223:37)
at callback.type (/home/kyrre/beekeeper-frontend/node_modules/broccoli-less/node_modules/less/lib/less/index.js:226:29)
at Object.oncomplete (fs.js:107:15)