Skip to content
This repository was archived by the owner on Aug 28, 2026. It is now read-only.
This repository was archived by the owner on Aug 28, 2026. It is now read-only.

Use PostCSS #54

Closed
Closed

Description

@ai

fastparse is awesome tool. But if you will move to PostCSS you will have these benefits:

  1. Most of source map code will be in PostCSS.
  2. You can replace url() and support @import with full CSS parsing. It is much safer. We are already have awesome plugins for url() and @import.
  3. PostCSS has “Safe Mode” to parse any legacy CSS (even broken).
  4. Right now @ben-eb creating awesome modular CSS minifier (it is much easier to fix and develop modular tool) cssnano. Right now it has better results that [clean-css] without advanced mode. So, when it became equal to clean-css, we can use it, because it is a PostCSS plugin with same source map support.

@markdalgleish what do you think as PostCSS plugin developer?

Activity

  1. markdalgleish commented on May 14, 2015

    @markdalgleish
    Contributor

    @ai It worked really well for me given I had zero experience beforehand.

    One question I have though—does PostCSS parse selectors into an AST? I'm currently transforming selectors using regular expressions which I know isn't going to work in the long run, and it'd be much better to operate on an AST instead of a string.

  2. ai commented on May 14, 2015

    @ai
    ContributorAuthor

    @markdalgleish there is no selector parser right now and you can use css-selector-parser. @ben-eb is developing new parser, but as I know it will not be ready in this month.

  3. sokra commented on May 14, 2015

    @sokra
    Member

    PostCSS is nice. We previously used a full parser for the url() and imports (and now local) parsing, but using a simple string parser has the following benefits:

    I'm fine with changing the css minimizer to PostCSS if it's better.

  4. ai commented on May 14, 2015

    @ai
    ContributorAuthor

    @sokra but it is not safe ;).

    a {
        content: "do not use url(path)";
    }
  5. ai commented on May 14, 2015

    @ai
    ContributorAuthor

    @sokra and more details for you reasonable counterarguments:

    • Of course, regexp shouldbe faster, than parser. But PostCSS is one of the fastest parsers written on JS. It is 4.5 times faster, that gonzales, that you use before.
    • PostCSS Safe Mode is a answer for future compatible. It will parse anything.
    • What is a locals? Is it relevant for postcss-local-scope?
    • We need a AST to safe change CSS.
    • It is not really simple right now. You have a lot of soure map code, which will be removed with PostCSS. PostCSS already had good postcss-url and postcss-import by @MoOx. You can use them and it will clean your code and be better for maintaining.
  6. added a commit that references this issue on May 14, 2015
  7. sokra commented on May 14, 2015

    @sokra
    Member

    If you want to do a PR, feel free to do so, but I still think it not worth the work. The current parser is functional and works fine. postcss-url and postcss-import won't help here, because they do it different than the css-loader.

  8. MoOx commented on May 14, 2015

    @MoOx

    The current parser is functional and works fine

    Not really, there is some case where latest css syntax is causing issue (if you minify) which break the process.

  9. sokra commented on May 15, 2015

    @sokra
    Member

    The minimizer and the parser are separate things in the css-loader. I'm fine with replacing the minimizer with PostCSS (that not much work).

  10. added 2 commits that reference this issue on Jun 16, 2015
    d87b5bd
    420bd9e
  11. airtonix commented on Jul 22, 2016

    @airtonix

    css-loader shouldn't do any post processing...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions