0

我正在尝试为 ember-cli 制作一个 SCSS lint 插件(我知道已经存在一个ember-cli-scsslint但我想要一个更可定制的)。我想知道是否有人有使用 broccoli-scss-lint 的经验,因为我在输入样式树时遇到了问题,并且 scss-lint 实际上对我的文件进行了 lint。

到目前为止我写的代码是:

module.exports = {
  name: 'ember-cli-scss-lint',

  included: function(app) {
    this._super.included.apply(this, arguments);
    this.app = app;
    var _this = this;

    app.registry.add('css', {
      name: this.name,
      ext: 'scss',
      toTree: function(tree) {
        var options, defaultOptions, scsslintConfig;

        options = app.options.scsslintOptions || {};
        defaultOptions = {
          config: path.join(_this.project.root, '/.scss-lint.yml');,
          bundleExec: false
        };

        scsslintConfig = merge(defaultOptions, options);
        return scssLint(tree, scsslintConfig);
      }
    });
  }
};

其中 config 是一个包含 scss-lint 配置的 YAML 文件。使用此设置,不会通过对scssLint. 我做错了什么令人难以置信的明目张胆的事情吗?

4

1 回答 1

0

I was unable to use the tree passed in from toTree so I instead settled for grabbing the styles tree from the application app.trees.style and that seems to have done the trick.

I feel this is more a limitation of broccoli-scsslint than ember-cli.

If anybody can suggest an improvement, you can checkout my code here: ember-cli-scsslint

于 2015-05-11T09:02:25.273 回答