Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Webpack Symfony4,无法使用网页包缩小CSS_Webpack_Minify_Symfony4 - Fatal编程技术网

Webpack Symfony4,无法使用网页包缩小CSS

Webpack Symfony4,无法使用网页包缩小CSS,webpack,minify,symfony4,Webpack,Minify,Symfony4,我有一个symfony4web应用程序,我正在尝试缩小CSS,但是它不起作用。我已经试了几个小时了,但我还没能让它提供一个小型版本。我做错什么了吗 webpack.config.js var Encore = require('@symfony/webpack-encore'); Encore // the project directory where compiled assets will be stored .setOutputPath('public/build/')

我有一个symfony4web应用程序,我正在尝试缩小CSS,但是它不起作用。我已经试了几个小时了,但我还没能让它提供一个小型版本。我做错什么了吗

webpack.config.js

var Encore = require('@symfony/webpack-encore');

Encore
    // the project directory where compiled assets will be stored
    .setOutputPath('public/build/')
   // the public path used by the web server to access the previous 
directory
    .setPublicPath('/build')
    .cleanupOutputBeforeBuild()
    .enableSourceMaps(!Encore.isProduction())

    .splitEntryChunks()
    .enableSingleRuntimeChunk()
    .enablePostCssLoader()


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

    // uncomment to define the assets of the project
     .addEntry('js/app', './assets/js/app.js')
    // .addStyleEntry('css/app', './assets/css/app.scss')

    // uncomment if you use Sass/SCSS files
    // .enableSassLoader()

    // uncomment for legacy applications that require $/jQuery as a 
global variable
    // .autoProvidejQuery()



;


module.exports = Encore.getWebpackConfig();
postsss.config.js

module.exports = {
    plugins: {
        // include whatever plugins you want
        // but make sure you install these via yarn or npm!

        // add browserslist config to package.json (see below)
        autoprefixer: {}
    }
}

您需要编译您的资产,以便使用
纱线安可制作


我不确定,但是
npm encore production
/node\u modules/.bin/encore production
也应该可以工作。

您需要编译您的资产,以便使用
纱线encore production


我不确定,但是
npm encore production
/node\u modules/.bin/encore production
也应该可以工作。

您尝试用webpackEncore编译什么命令?如果我没记错的话,你需要为制作进行编译以缩小规模,但我现在不确定。我是用Thread encore dev做的。但是当我用Thread encore制作时,它缩小了规模。这是正确的答案!我不确定,但很好,就这样。我将给出答案,这样您就可以将问题标记为solved您尝试使用webpackEncore编译的命令是什么?如果我没记错的话,你需要为制作进行编译以缩小规模,但我现在不确定。我是用Thread encore dev做的。但是当我用Thread encore制作时,它缩小了规模。这是正确的答案!我不确定,但很好,就这样。我来回答你,这样你就可以把问题标记为已解决