scripts/webpack/libParts.js
function extractSass(files) {

        // note:  The way we're setting up webpack here seems a bit of a hack:
        //
        // Although the setup creates two bundles seperating the js and css as desired,
        // it's also producing an extra styles.js file which we're throwing away/ignoring.
        // The alternative, more supported way of things, is to leave the css inline
        // within js and let the styles plugin add the css at runtime to the html page.
        // At the moment keeping with the extracted css as:
        // 1. more familar to angular 1 developers (?)
        // 2. maintains backwards compatibility with the existing apps that expects
        //    the css to be delivered to the browser as a seperate file

        const filename = env.prod ? `${libraryName}.min.css` : `${libraryName}.css`;
        const extractor = new ExtractTextPlugin(filename);
        let loader;
        if (env.debug || env.prod) {
            loader = 'css-loader?sourceMap!sass-loader?sourceMap';
        } else {
            loader = 'css-loader!sass-loader';
        }
        return {
            entry: {
                styles: files
            },
            module: {
                rules: [
                    {
                        test: /\.scss$/,
                        loader: extractor.extract(loader),
                        include: files
                    }
                ]
            },
            plugins: [
                extractor
            ]
        };
    }
function extractSass(files) {

        // note:  The way we're setting up webpack here seems a bit of a hack:
        //
        // Although the setup creates two bundles seperating the js and css as desired,
        // it's also producing an extra styles.js file which we're throwing away/ignoring.
        // The alternative, more supported way of things, is to leave the css inline
        // within js and let the styles plugin add the css at runtime to the html page.
        // At the moment keeping with the extracted css as:
        // 1. more familar to angular 1 developers (?)
        // 2. maintains backwards compatibility with the existing apps that expects
        //    the css to be delivered to the browser as a seperate file

        const filename = env.prod ? `${libraryName}.min.css` : `${libraryName}.css`;
        const extractor = new ExtractTextPlugin(filename);
        let loader;
        if (env.debug || env.prod) {
            loader = 'css-loader?sourceMap!sass-loader?sourceMap';
        } else {
            loader = 'css-loader!sass-loader';
        }
        return {
            entry: {
                styles: files
            },
            module: {
                rules: [
                    {
                        test: /\.scss$/,
                        loader: extractor.extract(loader),
                        include: files
                    }
                ]
            },
            plugins: [
                extractor
            ]
        };
    }
function extractSass ( files ) { // note:  The way we're setting up webpack here seems a bit of a hack: // // Although the setup creates two bundles seperating the js and css as desired, // it's also producing an extra styles.js file which we're throwing away/ignoring. // The alternative, more supported way of things, is to leave the css inline // within js and let the styles plugin add the css at runtime to the html page. // At the moment keeping with the extracted css as: // 1. more familar to angular 1 developers (?) // 2. maintains backwards compatibility with the existing apps that expects //    the css to be delivered to the browser as a seperate file const filename = env . prod ? ` ${ libraryName } ` : ` ${ libraryName } ` ; const extractor = new ExtractTextPlugin ( filename ) ; let loader ; if ( env . debug || env . prod ) { loader = 'css-loader?sourceMap!sass-loader?sourceMap' ; } else { loader = 'css-loader!sass-loader' ; } return { entry : { styles : files } , module : { rules : [ { test : / \.scss$ / , loader : extractor . extract ( loader ) , include : files } ] } , plugins : [ extractor ] } ; }
Extracts styles into a seperate bundle
Extracts styles into a seperate bundle