Skip to content

Scopify with CSS modules and Webpack #2

@griable

Description

@griable

Hi,

First I apologise since it not directly a Scopify issue but more a CSS Module + Scopify usage question.

I would like to be able to use Scopify with CSS Modules and its composition system but I'm currently out of luck.

The problem is that composition only works with local filenames such as .root and using it with Scopify make it #app .root which leads to the following error :

Module build failed:
Error: composes is only allowed when selector is single :local class name not in ":local(#app) :local(.root)"

My configuration is :

var webpackConfig = {
  context: jsSrc,
  plugins: [],
  resolve: {
    extensions: [''].concat(extensions),
    modulesDirectories: ['node_modules', 'components']
  },
  module: {
    loaders: [
      {
        test: /\.js$/,
        loader: 'babel-loader?stage=1',
        exclude: /node_modules/
      },
      {
        test: /\.css$/,
        loader: ExtractTextPlugin.extract('style-loader', 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader')
      }
    ]
  },
  postcss: [
    require('autoprefixer'),
    require('postcss-nested'),
    require('postcss-scopify')('#app')
  ],
  plugins: [
    new ExtractTextPlugin('style.css', { allChunks: true })
  ]
}

Finally, my question is, is there anyway to get the code prefixed by Scopify after it has been parsed by the CSS loader.

Thank you for helping!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions