Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack Encore - minifying and versioning ??? #17

Open
Ppito opened this issue Feb 14, 2018 · 1 comment
Open

Webpack Encore - minifying and versioning ??? #17

Ppito opened this issue Feb 14, 2018 · 1 comment

Comments

@Ppito
Copy link

Ppito commented Feb 14, 2018

Hello,

I need some help, I want to use your plugins with Webpack Encore, but the versioning and minifying not process the generated files, any ideas ?

Config :

// webpack.config.js

let Encore            = require('@symfony/webpack-encore');
let GoogleFontsPlugin = require("google-fonts-webpack-plugin");

Encore
// directory where all compiled assets will be stored
    .setOutputPath('./www/build/')

    // what's the public path to this directory (relative to your project's document root dir)
    .setPublicPath('/build')

    // // empty the outputPath dir before each build
    .cleanupOutputBeforeBuild()

    .addPlugin(new GoogleFontsPlugin({
        fonts: [
            { family: "Roboto", variants: [ "300", "700", "300italic", "700italic" ] },
            { family: "Roboto Slab", variants: ["700" ] },
        ],
        "path": "fonts/",
        "filename": "css/google-fonts.css"
    }))

    // will output as web/build/global.css
    .addStyleEntry('css/style', './www/css/styles.css')

    .enableSourceMaps(!Encore.isProduction())

    // create hashed filenames (e.g. app.abc123.css)
    .enableVersioning(Encore.isProduction())
;


// export the final configuration
module.exports = Encore.getWebpackConfig();

Command :

yarn encore production

I even tried to add .addStyleEntry('css/google-fonts.min', './www/build/css/google-fonts.css') in the configuration but Webpack throw this error :

Entry module not found: Error: Can't resolve './www/build/css/google-fonts.css' in '/home/XXX'

@JohJohan
Copy link

JohJohan commented Mar 7, 2018

Any updates on this issue? I have the same problem i want the fonts.css to be minified when deploying to production

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants