Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

256
Vistas
Webpack sass where is the css file

I am using web pack with sass loader like this:

module.exports = {
  module: {
    loaders: [
      {
        test: /\.scss$/,
        loader: "style!css!sass"
      }
    ]
  }
};

But i see the styles apply to the style tag, where is the generate css file?

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

By default, the style-loader inlines the compiled css into your bundle, which are added to the head of the page with the output file e.g. bundle.js. Using the extract-text-webpack-plugin you can remove the compiled css from the bundle, and export it to a separate file.

First - wrap your loader in the plugin:

 loaders: [{
  test: /\.scss$/,
  loader: ExtractTextPlugin.extract(
    "style",
    "css!sass")
 }]
},

Then tell the plugin what to call the file it generates:

plugins: [
    new ExtractTextPlugin("app.css")
 ]

Include this file in your HTML normally.

over 4 years ago · Santiago Trujillo Denunciar

0

If you want a separate CSS file when using Webpack, you need to use the extract-text-webpack-plugin.

over 4 years ago · Santiago Trujillo Denunciar

0

The extract-text-webpack-plugin has been deprecated you should use the mini-css-extract-plugin. Assuming you have your styles in css/app.scss, your entry file should import it as usual like:

import 'css/app.scss';

Add the plugin:

plugins: [new MiniCssExtractPlugin()]

And add the plugin to your loader chain:

{
  test: /\.s[ac]ss$/i,
  use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader']
}

When you run webpack with that configuration you'll end up with an app.css file loaded in your HTML with a tag similar to:

<link href="app.css" rel="stylesheet">
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda