Skip to content

v2.0.0 #177

Closed
Closed

Description

@michael-ciniawsky

Roadmap

  • Drop node =< v4
  • Add schema-utils (Options Validation)
  • Update loader-utils
  • Update README.md
  • Refactor Tests (webpack && Jest)
  • Refactor options.config = { path: 'path/to/config', ctx: {} }
  • Expose ctx = { file, options, env }
  • Export Modules (CJS)
  • PostCSS v6.0.0

webpack.config.js

{
  test: /\.css$/
  use: [ 
    { 
      loader: 'postcss-loader',
      options: { config: { path: 'path/to/postcss.config.js', ctx: {} }
    }
  ]
}

postcss.config.js

module.exports = ({ file, options, env }) => ({
    parser: file.extname === '.sss' ? 'sugarss' : false,
    plugins: {
      'postcss-import': { root: file.dirname },
      'postcss-modules': options.modules ? {} : false
      'cssnano': env === 'production' ? { safe: true } : false
    }    
})

Breaking Chances

  • Removectx.webpack
  • Remove Presets options.pack
  • Remove webpack Plugin Hook

cc @ai

Activity

  1. ai commented on Feb 22, 2017

    @ai
    Contributor

    Remove ctx.webpack (big && slow) in favour of ctx.file ?

    Maybe. What other useful information could be in loader?

    Remove Presets/Packages options.pack ?

    I afraid webpack 1 users :D. But pack is not so popular. We can ask them to migrate to webpack 2 or keep old version.

    Drop node v0.10/0.12?

    Of course.

    Wait for PostCSS v6.0.0?

    Good idea if we can wait about month (I am preparing for React London).

  2. michael-ciniawsky commented on Feb 22, 2017

    @michael-ciniawsky
    ContributorAuthor

    Maybe. What other useful information could be in loader?

    The only important I can think of atm is loader.addDependency(file) => ctx.watch(file)/ctx.webpack.watch(file) , but I will check what else we may have there 😛

    I afraid webpack 1 users :D. But pack is not so popular. We can ask them to migrate to webpack 2 or keep old version.

    I have no Twitter, but maybe a poll would be a good idea to see how popular the feature is, never seen it in the endless configs @extrac-text-webpack-plugin and the like, but who knows...

    Of course.

    👍

    Good idea if we can wait about month (I am preparing for React London).

    Yep I also in favour to wait, no rush at all and if I have a month to get it working I will continue experimenting with 'removing' css-loader and get CSSModules working with postcss-loader ou-of-the-box e.g

    // Last Loader e.g 'postcss-loader!sass-loader'
    if (loader.loaderIndex >= 0) 
       // webpack 2 => ES2015 Module
       if (process.env.WEBPACK_VERSION === 2) {
          const module = `export default ${result.css}`
          return callback(null, module)
       }
       // webapck 1 => CJS Module
       const module = `module.exports = ${result.css}`
       return callback(null, module)
    } else {
       // Next Loader => {String}
       return callback(null, result.css)
    }

    But experimental and only if it works without headaches :D

  3. ai commented on Feb 22, 2017

    @ai
    Contributor

    I added issue to bookmarks and will tweet about it on next week to collect more feedback.

    Also we will need good step-by-step migration instructions.

  4. changed the title [-]v2 ?[/-] [+]v2[/+] on Mar 1, 2017
  5. changed the title [-]v2[/-] [+]v2.0.0[/+] on Mar 28, 2017
  6. alexander-akait commented on Apr 13, 2017

    @alexander-akait
    Member

    /cc @michael-ciniawsky Should we wait postcss 6.0.0 before we can release 2.0.0? Maybe for postcss 6.0.0 version we will use 3.0.0. I'm interested in a new version where there will not be a css-loader. They are use css-modules, but in most project i don't use their ( i am losing performance 😭 ).

  7. michael-ciniawsky commented on Apr 13, 2017

    @michael-ciniawsky
    ContributorAuthor

    @evilebottnawi I need to triage a few small things before actually ready and @ai needs to approve it then :), It's blocked by a few other things, while we can go with module.exports (CJS) for now, I need to test adding css-base from css-loader first (Module Deduplication), it's more complicated 😛

  8. ai commented on Apr 13, 2017

    @ai
    Contributor

    @michael-ciniawsky maybe you should be a maintainer for this loader? Anyway you answered for most of issues. Rest work is simple and doesn't need too much time.

  9. alexander-akait commented on Apr 13, 2017

    @alexander-akait
    Member

    @ai @michael-ciniawsky i can help with this, besides, I am well acquainted with postcss and webpack 😄

  10. ai commented on Apr 13, 2017

    @ai
    Contributor

    Good idea too. Let's wait for @michael-ciniawsky answer and transfer maintaince 😊

  11. michael-ciniawsky commented on Apr 13, 2017

    @michael-ciniawsky
    ContributorAuthor

    @ai ? 🙃 I can take 'full' maintainance of this loader of course 😛 npm owner add or an npm organisation (teams) in case you want more 'control'.

    @evilebottnawi Yeah sure welcome, Angular Commit Convention (standard-version => CHANGELOG.md), StandardJS >= v2.0.0 and we are up and running :)

  12. michael-ciniawsky commented on Apr 13, 2017

    @michael-ciniawsky
    ContributorAuthor

    @evilebottnawi I will recommend you for css-loader and co aswell, if you are interested, we need all hands we can get :D

  13. michael-ciniawsky commented on Apr 13, 2017

    @michael-ciniawsky
    ContributorAuthor

    @ai postcss-loader => webpack-contrib?

  14. ai commented on Apr 13, 2017

    @ai
    Contributor

    @michael-ciniawsky welcome on board (you can add @evilebottnawi as well).

    I hope to release PostCSS 6 in next week.

  15. michael-ciniawsky commented on Apr 13, 2017

    @michael-ciniawsky
    ContributorAuthor

    No rush the webpack part will take longer :D

  16. alexander-akait commented on Apr 17, 2017

    @alexander-akait
    Member

    @michael-ciniawsky Today I thought and came to a conclusion: now css-loader is not css loader (some project don't use css-modules, but css-loader use their and it is weird and no way disable their, module: false it is not solution, because postcss-modules-* plugins anyway apply).

    In postcss-loader we want using their without css-loader, be right move all logic exclude css-modules from css-loader, also be right rename css-loader to css-modules-loader and remove all behavior not related to css-modules (imports, urls and etc). It is allow use postcss-loader for project don't use css-modules, if you need css-modules, just add css-modules-loader above postcss-loader.

    This would not only give a huge performance advantage, but also clearly divide the mixed logic, which causes the head to explode

  17. alexander-akait commented on Apr 17, 2017

    @alexander-akait
    Member

    @michael-ciniawsky Also after release postcss-loader v2 it is should be named as css-loader 😄 (because it is veritable loader for css, without extra mixed logic as in css-loader).

  18. michael-ciniawsky commented on Apr 18, 2017

    @michael-ciniawsky
    ContributorAuthor

    @evilebottnawi Could you please drop my your e-mail so we can add you to the @webpack slack 😛?

  19. alexander-akait commented on Apr 18, 2017

    @alexander-akait
    Member
  20. michael-ciniawsky commented on Apr 18, 2017

    @michael-ciniawsky
    ContributorAuthor

    You should got or get an invite soon :)

  21. added this to the milestone on Apr 24, 2017
  22. modified the milestone: on May 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions