Skip to content

Prepend @import for every sass file #491

@TimoRuetten

Description

@TimoRuetten

Hi!

I am trying to solve to prepend a @import in any loaded sass file. After I checked your docs I think this should be solved with options: { data: '@import ...' } but in my case it seems that this does not work.

// ...
{
        test: /\.scss$/,
        loader: ExtractTextPlugin.extract({
          loader: [
            {
              loader: 'css-loader',
              query: {
                localIdentName: '[hash:8]',
                modules: true,
              },
            },
            {
              loader: 'postcss-loader',
            },
            {
              loader: 'sass-loader',
              options: {
                data: `@import ${path.resolve(__dirname, 'src/both/ui/theme/_theme.scss')};`,
              },
            },
          ],
        }),
      },
// ...

I am using webpack 2.2 and sass-loader 6

My bundled css file does not contain the content of the _theme.scss file.

I am sorry if I am missing smth basic here because webpack and all the loader logic etc. is pretty new for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions