egoist / rollup-plugin-postcss

Seamless integration between Rollup and PostCSS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No option to generate moduler css along with one single css which will load separately into dom

OmKessarwani opened this issue · comments

I have below post css config where I'm generating css from scss file in moduler way. But I have one global scss file which I want to load direct into dom.My current code inject that gloabl scss into each module.

`postcss({
      use: [
        ['sass', { data: '@import "./src/commonStyles/_commoncss.scss";' }] // global scss injection into each `module`
      ],
      plugins: [
        autoprefixer(),
        postcssImport({
          // Resolve SCSS imports and convert to CSS
          resolve: function (filename, base) {
            return new Promise(function (resolve, reject) {
              sass.render(
                {
                  file: `${base}/${filename}`
                },
                function (err, result) {
                  if (err) {
                    reject(err)
                  } else {
                    resolve({
                      contents: result.css.toString()
                    })
                  }
                }
              )
            })
          }
        })
      ],
      modules: true, // // Include CSS in the JavaScript bundle
      extract: false // Do not extract CSS into a separate file
    })`