egoist / rollup-plugin-postcss

Seamless integration between Rollup and PostCSS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: Use of 'include' option

viniciosanacleto opened this issue · comments

I have the same problem as described in the issue #160. So i implemented the folllowing solution to generate the separated CSS :

//rollup.config.js

const glob = require('glob')
const path = require('path')
const postcss = require('rollup-plugin-postcss')

const bundleCss = () => {
  var config = []
  var files = glob.sync(path.resolve(__dirname, '**/*.css'))
  files.forEach(file => {
    var filename = file.substr(file.lastIndexOf('/') + 1, file.length).toLowerCase()
    config.push(
      postcss({
        include: file,
        extract: path.resolve(`dist/${filename}`),
        minimize: true
      })
    )
  })
  return config
}

modules.exports = {
  plugins: [
    ...bundleCss()
  ]
}

It worked well, but i'm worried about the use of the option include. I didn't find information about this option in the docs, then i have some questions:

  • There's a better (or the right) way to solve this problem?
  • The include option will be supported in the future?