我最近将 ember-cli 升级到 .39,并且某些内容发生了变化,导致我的 broccoli-compass 代码被破坏。
代码如下:
app.styles = function() {
return compileCompass(this.appAndDependencies(), this.name + '/styles/app.scss', {
compassCommand: 'bundle exec compass',
outputStyle: 'expanded',
sassDir: this.name + '/styles',
imagesDir: 'public/images',
cssDir: '/assets'
});
};
我收到此错误:
[broccoli-compass] Error: Command failed: Errno::ENOENT on line ["155"] of ~/.rvm/gems/ruby-2.1.1/gems/compass-0.12.6/lib/compass/compiler.rb: No such file or directory @ rb_sysopen - ~/campaign-designer/ember/tmp/tree_merger-tmp_dest_dir-pSk32Zuy.tmp/campaign-designer/styles/app.scss
Run with --trace to see the full backtrace
arguments: `bundle exec compass compile campaign-designer/styles/app.scss --relative-assets --sass-dir campaign-designer/styles --output-style expanded --images-dir public/images --css-dir "../compass_compiler-tmp_cache_dir-8Yu97OaF.tmp/assets"`
app.styles
或 this.appAndDependency()
已更改吗?我已经尝试了此配置的许多变体,但均无济于事。
有一个类似的问题here ,但我仍然无法让事情正常运转。
最佳答案
无论如何,这样的事情最终帮助了我:
// Compass config in Brocfile.js
app.registry.add('css', 'broccoli-compass', 'scss', {
toTree: function(tree, inputPath, outputPath, options) {
// broccoli-compass doesn't like leading slashes
if (inputPath[0] === '/') { inputPath = inputPath.slice(1); }
// tree = mergeTrees([
// tree,
// 'public'
// ], {
// description: 'TreeMerger (stylesAndVendorAndPublic)'
// });
return compileCompass(tree, inputPath + '/app.scss', {
outputStyle: 'expanded',
// require: 'sass-css-importer', // Allows us to import CSS files with @import("CSS:path")
sassDir: inputPath,
imagesDir: 'images',
//fontsDir: 'fonts',
cssDir: outputPath
});
}
});
最终我从我的项目中删除了 compass(我只需要自己编写一些 SASS mixin)以避免配置带来的麻烦 + 尝试获得更快的构建速度。
更新:您现在可能想查看ember-cli-compass-compiler ember-cli 插件,这使得您可以更轻松地在 ember-cli 项目中开始使用 Compass。
关于ember-cli - 西兰花指南针和 ember-cli 0.39,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24645931/