Wondering what’s next for npm?Check out our public roadmap! »

    @taskr/postcss

    1.1.2 • Public • Published

    @taskr/postcss npm

    PostCSS plugin for Taskr.

    Install

    $ npm install --save-dev @taskr/postcss
    

    API

    .postcss([options])

    Check out PostCSS's Options documentation to see the available options.

    Note: There should be no need to set options.to and options.from.

    If you would like to autoload external PostCSS config, you must not define any options directly.

    Usage

    Embedded Options

    Declare your PostCSS options directly within your taskfile.js:

    exports.styles = function * (task) {
      yield task.source('src/**/*.scss').postcss({
        plugins: [
          require('precss'),
          require('autoprefixer')({
            browsers: ['last 2 versions']
          })
        ],
        options: {
          parser: require('postcss-scss')
        }
      }).target('dist/css');
    }

    Autoloaded Options

    Automatically detect & connect to existing PostCSS configurations

    If no options were defined, @taskr/postcss will look for existing .postcssrc, postcss.config.js, and .postcssrc.js root-directory files. Similarly, it will honor a "postcss" key within your package.json file.

    • .postcssrc -- must be JSON; see example
    • .postcssrc.js -- can be JSON or module.exports a Function or Object; see example
    • postcss.config.js -- can be JSON or module.exports a Function or Object; see example
    • package.json -- must use "postcss" key & must be JSON; see example

    Important: If you take this route, you only need one of the files mentioned!

    // taskfile.js
    exports.styles = function * (task) {
      yield task.source('src/**/*.scss').postcss().target('dist/css');
    }
    // .postcssrc
    {
      "plugins": {
        "precss": {},
        "autoprefixer": {
          "browsers": ["last 2 versions"]
        }
      },
      "options": {
        "parser": "postcss-scss"
      }
    }

    Support

    Any issues or questions can be sent to the Taskr monorepo.

    Please be sure to specify that you are using @taskr/postcss.

    License

    MIT © Luke Edwards

    Install

    npm i @taskr/postcss

    DownloadsWeekly Downloads

    6

    Version

    1.1.2

    License

    MIT

    Last publish

    Collaborators

    • avatar