Replace broccoli-sass with broccoli-compass in broccoli-sample-app

◇◆丶佛笑我妖孽 提交于 2019-11-30 19:20:39

问题


I'm attempting to replace broccoli-sass with broccoli-compass, in the Broccoli Ember Sample.

My app structure looks like:

app
public
styles
  app.scss

Brocfile:

...
var compileSass = require('broccoli-compass')
...
var appNamespace = 'my-app-name';

function preprocess (tree) {
  tree = filterTemplates(tree, {
    extensions: ['hbs', 'handlebars'],
    compileFunction: 'Ember.Handlebars.compile'
  })

  return tree
}

var app = 'app'
app = pickFiles(app, {
  srcDir: '/',
  destDir: appNamespace // move under app namespace
})
app = preprocess(app)

var styles = 'styles'
styles = pickFiles(styles, {
  srcDir: '/',
  destDir: appNamespace
})
styles = preprocess(styles)

var tests = 'tests'
tests = pickFiles(tests, {
  srcDir: '/',
  destDir: appNamespace + '/tests'
})
tests = preprocess(tests)

var vendor = 'vendor'

var sourceTrees = [app, styles, vendor]
if (env !== 'production') {
  sourceTrees.push(tests)
}
sourceTrees = sourceTrees.concat(findBowerTrees())

var appAndDependencies = new mergeTrees(sourceTrees, { overwrite: true })

var appJs = compileES6(appAndDependencies, {
  loaderFile: 'loader.js',
  ignoredModules: [
    'ember/resolver'
  ],
  inputFiles: [
    appNamespace + '/**/*.js'
  ],
  legacyFilesToAppend: [
    'jquery.js',
    'handlebars.js',
    'ember.js',
    'ember-resolver.js'
  ],
  wrapInEval: false,
  outputFile: '/assets/app.js'
})

var appCss = compileSass(appAndDependencies, 'styles/app.scss')

var publicFiles = 'public'

module.exports = mergeTrees([appJs, appCss, publicFiles])

However, I'm getting the following error when calling broccoli serve:

[broccoli-compass] Error: No such file or directory - /Users/my.name/Documents/Code/broccoli-ember/tmp/tree_merger-tmp_dest_dir-4rW9S0CD.tmp/styles/app.scss

Any idea what I'm missing here?


回答1:


I changed the brocfile styles preprocess to:

var styles = 'styles'
styles = pickFiles(styles, {
  srcDir: '/',
  destDir: appNamespace + '/styles'
})
styles = preprocess(styles)

and the compileSass call to:

var appCss = compileSass(appAndDependencies, appNamespace + '/styles/app.scss', {
    outputStyle: 'expanded',
    sassDir: appNamespace + '/styles',
    imagesDir: 'public/images/',
    cssDir: '/assets'
})

Similar to the answer here - Compiling Compass in an Ember-CLI project



来源:https://stackoverflow.com/questions/24365966/replace-broccoli-sass-with-broccoli-compass-in-broccoli-sample-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!