在 Ember-CLI 项目中编译 Compass [英] Compiling Compass in an Ember-CLI project

查看:19
本文介绍了在 Ember-CLI 项目中编译 Compass的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 ember-cli v0.0.23,并且正在尝试获取 broccoli-compass 包与我的项目一起工作,但我遇到了一些问题.

I'm using ember-cli v0.0.23, and am trying to get the broccoli-compass package working with my project, and I've run into some problems.

首先,在我的 Brocfile 中,我替换了标准 Ember-CLI蓝图"版本:

First, in my Brocfile, I have replaced the standard Ember-CLI "blueprint" version of:

var styles = preprocessCss(appAndDependencies, prefix + '/styles', '/assets');

具有以下内容:

var compileCompass = require('broccoli-compass');
var styles = compileCompass(appAndDependencies, 'app/styles/app.scss', {
    outputStyle: 'expanded',
    sassDir: 'app/styles',
    imagesDir: 'public/images/'
});    

但是,当我运行 ember build 时,我收到以下输出:

However, when I run an ember build, I receive the following output:

$ ember build
[broccoli-compass] Error:  Command failed: Errno::ENOENT on line ["155"] of /Library/Ruby/Gems/2.0.0/gems/compass-0.12.6/lib/compass/compiler.rb: No such file or directory - /Users/gaker/Sites/project/tmp/tree_merger-tmp_dest_dir-GrWa8Zva.tmp/app/styles/app.scss
Run with --trace to see the full backtrace. The command-line arguments was: `compass compile app/styles/app.scss --relative-assets --sass-dir app/styles --output-style expanded --images-dir public/images/ --css-dir "../compass_compiler-tmp_dest_dir-eFsq51BG.tmp"`

如果我尝试运行终端错误中输出的 compass 命令,它确实会创建文件,只是它位于我的项目根目录的一个目录中(注意 --css-dir 在输出中).

If I try to run the compass command that is output in the error in my terminal, it does create the file, only it is up one directory from my project root (notice --css-dir in the output).

在调用 compileCompass 时,我尝试了多种选项 sassDirimagesDir 等的组合,这是我得到的最接近的组合.

I have tried many combinations of options sassDir, imagesDir, etc when calling compileCompass and this is the closest I've gotten.

那么我有什么想法可以让指南针、broccoli-compass 和 ember-cli 顺利运行吗?

So any ideas on what I can do to successfully get compass, broccoli-compass and ember-cli playing nicely?

提前致谢

推荐答案

试试这个(添加前缀和 cssDir):

Try this (added prefix and cssDir):

var compileCompass = require('broccoli-compass');
var styles = compileCompass(appAndDependencies, prefix + '/styles/app.scss', {
    outputStyle: 'expanded',
    sassDir: prefix + '/styles',
    imagesDir: 'public/images/',
    cssDir: '/assets'
});

史蒂芬

这篇关于在 Ember-CLI 项目中编译 Compass的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆