Giter Club home page Giter Club logo

Comments (4)

jeffjewiss avatar jeffjewiss commented on May 30, 2024

Yeah, I couldn't get postcss-bem-linter working either and I'm using postcss-import to process import rules as well. I didn't realize that the @define had to be on the first line in a separate file, but that makes sense otherwise it would be difficult to tell when to stop linting for that component.

I'm not quite sure how to fix this just yet. I think my assumption to use app.css or {app-name}.css is too strict and was a naive first implementation to quickly get postcss working with ember-cli.

I'll need to think about this. I don't want to break how the addon currently works, but this definitely needs to be addressed.

from ember-cli-postcss.

ismay avatar ismay commented on May 30, 2024

I'm not quite sure how to fix this just yet. I think my assumption to use app.css or {app-name}.css is too strict and was a naive first implementation to quickly get postcss working with ember-cli.

I'd say it is a good default (except for {app-name}.css, which ember-cli does not accept as an entry point for me, v0.2.3).

Maybe it would make sense to allow for people to define their own array of entry points (with globbing), and default to all css in the app/styles folder, but not the folders below it (which are typically used for partials)? You could also allow people to explicitly define partials, and then default to folders below app/styles.

I'd almost think that you'd need different stages in the preprocessing for the types of uses that I've encountered):

  1. process all css (and do stuff like linting all css with bem-linter)
  2. process only the entry points and build

Maybe a key in the plugin array besides module, options could define whether the plugin is to be used for step 1 or step 2?

from ember-cli-postcss.

ismay avatar ismay commented on May 30, 2024

Or, you could fork this plugin to use ember-cli's postprocessTree hook, and dedicate that fork exclusively to linting (since that's what the postprocessTree hook is for). That would separate the two use-cases cleanly.

Not sure whether postprocessTree can pass all files separately though, but if it doesn't, I'd say that that's an upstream issue to be fixed in ember-cli.

from ember-cli-postcss.

jeffjewiss avatar jeffjewiss commented on May 30, 2024

I was able to solve this issue and get BEM linting to work by passing plugins to the postcss-import plugin, which will run the plugins on each file it imports. I think this is likely a preferable solution to using the postprocessTree hook as everything will run in one place.

The config can look something like this:

postcssOptions.plugins = [
  {
    module: require('postcss-import'),
      options: {
        glob: true,
        plugins: [
          require('postcss-nesting'),
          require('postcss-nested'),
          require('postcss-bem-linter'),
          require('postcss-browser-reporter'),
          require('postcss-reporter')({
            clearMessages: true,
            noPlugin: true
          })
        ]
      }
    },
    <more plugins>
  }
]

I'm going to close this issue since it's possible to setup linting. Please reopen the issue if you're unable to get this working in your projects.

from ember-cli-postcss.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.