Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

webpack sass

const path = require("path");
let sassRule= {
        test: /.sass|scss$/i,
        use: ["style-loader", "css-loader", "sass-loader"],
    }
 module.exports = {
  entry: path.resolve(__dirname, "/src/index.js") // import sass file on javascript file
   module: {rules: sassRule}
 }
Comment

webpack compile sass to css file

const path = require('path');

const FixStyleOnlyEntriesPlugin = require("webpack-fix-style-only-entries");

module.exports = {
  entry: [
    __dirname + '/src/js/app.js',
    __dirname + '/src/scss/app.scss'
  ],
  output: {
    path: path.resolve(__dirname, 'dist'), 
    filename: 'js/app.min.js',
  },
  module: {
    rules: [
      {
        test: /.js$/,
        exclude: /node_modules/,
        use: [],
      }, {
        test: /.scss$/,
        exclude: /node_modules/,

        type: 'asset/resource',
        generator: {
          filename: 'css/[name].min.css'
        },

        use: [
          'sass-loader'
        ]
      }
    ]
  },
  plugins: [
    new FixStyleOnlyEntriesPlugin({ extensions:['scss'] }),
  ],
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: loop elements in javascript 
Javascript :: expo custom fonts 
Javascript :: math.floor js 
Javascript :: jquery remove class 
Javascript :: javascript enable clipboard 
Javascript :: how to get decimal value in js 
Javascript :: Remove Duplicates array values in javascript 
Javascript :: how to add custom font to react project 
Javascript :: get last word in string js 
Javascript :: javascript auto hide navbar 
Javascript :: download file from api vue 
Javascript :: javascript set property for each object in array of objects 
Javascript :: how to push array into array in angular 
Javascript :: nested object javascript 
Javascript :: aws amplify get JWT TOKEN 
Javascript :: Set up routes for vue in laravel 
Javascript :: js string to json 
Javascript :: "SyntaxError: Unexpected token o in JSON at position 1 
Javascript :: read excel file through nodejs 
Javascript :: shuffle array item javascruitp 
Javascript :: ifsc code yup validation 
Javascript :: jsx classname multiple 
Javascript :: export csv in react 
Javascript :: firebase timestamp to date angular 
Javascript :: jquery header basic auth 
Javascript :: offsetheight javascript 
Javascript :: change datetime format in js 
Javascript :: bootstrap programmatically change tab 
Javascript :: add numbers in array 
Javascript :: number_format in jquery 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =