enabled sass

This commit is contained in:
tracer 2022-04-11 13:32:33 +02:00
parent 3fa30dbde4
commit 3d1bbc9662
1 changed files with 63 additions and 64 deletions

View File

@ -1,47 +1,41 @@
const Encore = require("@symfony/webpack-encore"); const Encore = require('@symfony/webpack-encore');
// Manually configure the runtime environment if not already configured yet by the "encore" command. // Manually configure the runtime environment if not already configured yet by the "encore" command.
// It's useful when you use tools that rely on webpack.config.js file. // It's useful when you use tools that rely on webpack.config.js file.
if (!Encore.isRuntimeEnvironmentConfigured()) { if (!Encore.isRuntimeEnvironmentConfigured()) {
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || "dev"); Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
} }
const CopyWebpackPlugin = require("copy-webpack-plugin");
Encore Encore
// directory where compiled assets will be stored // directory where compiled assets will be stored
.setOutputPath("public/build/") .setOutputPath('public/build/')
.copyFiles({ .copyFiles({
from: "./assets/images", from: "./assets/images",
to: "images/[path][name].[ext]" to: "images/[path][name].[ext]"
}) })
// public path used by the web server to access the output path // public path used by the web server to access the output path
.setPublicPath("/build") .setPublicPath('/build')
// only needed for CDN's or sub-directory deploy // only needed for CDN's or sub-directory deploy
//.setManifestKeyPrefix('build/') //.setManifestKeyPrefix('build/')
/* /*
* ENTRY CONFIG * ENTRY CONFIG
* *
* Add 1 entry for each "page" of your app
* (including one that's included on every page - e.g. "app")
*
* Each entry will result in one JavaScript file (e.g. app.js) * Each entry will result in one JavaScript file (e.g. app.js)
* and one CSS file (e.g. app.scss) if your JavaScript imports CSS. * and one CSS file (e.g. app.css) if your JavaScript imports CSS.
*/ */
.addEntry("app", "./assets/js/app.js") .addEntry('app', './assets/app.js')
//.addEntry('page1', './assets/js/page1.js')
//.addEntry('page2', './assets/js/page2.js') // enables the Symfony UX Stimulus bridge (used in assets/bootstrap.js)
.enableStimulusBridge('./assets/controllers.json')
// When enabled, Webpack "splits" your files into smaller pieces for greater optimization. // When enabled, Webpack "splits" your files into smaller pieces for greater optimization.
.splitEntryChunks() .splitEntryChunks()
// will require an extra script tag for runtime.js // will require an extra script tag for runtime.js
// but, you probably want this, unless you're building a single-page app // but, you probably want this, unless you're building a single-page app
//.enableSingleRuntimeChunk() .enableSingleRuntimeChunk()
.disableSingleRuntimeChunk()
/* /*
* FEATURE CONFIG * FEATURE CONFIG
@ -56,29 +50,34 @@ Encore
// enables hashed filenames (e.g. app.abc123.css) // enables hashed filenames (e.g. app.abc123.css)
.enableVersioning(Encore.isProduction()) .enableVersioning(Encore.isProduction())
.configureBabel((config) => {
config.plugins.push('@babel/plugin-proposal-class-properties');
})
// enables @babel/preset-env polyfills // enables @babel/preset-env polyfills
.configureBabel(() => { .configureBabelPresetEnv((config) => {
}, { config.useBuiltIns = 'usage';
useBuiltIns: "usage", config.corejs = 3;
corejs: 3
}) })
// enables Sass/SCSS support // enables Sass/SCSS support
.enableSassLoader() .enableSassLoader()
.enableLessLoader()
// uncomment if you use TypeScript // uncomment if you use TypeScript
//.enableTypeScriptLoader() //.enableTypeScriptLoader()
// uncomment if you use React
//.enableReactPreset()
// uncomment to get integrity="..." attributes on your script & link tags // uncomment to get integrity="..." attributes on your script & link tags
// requires WebpackEncoreBundle 1.4 or higher // requires WebpackEncoreBundle 1.4 or higher
//.enableIntegrityHashes(Encore.isProduction()) //.enableIntegrityHashes(Encore.isProduction())
// uncomment if you're having problems with a jQuery plugin // uncomment if you're having problems with a jQuery plugin
.autoProvidejQuery() .autoProvidejQuery()
// uncomment if you use API Platform Admin (composer req api-admin)
//.enableReactPreset()
//.addEntry('admin', './assets/js/admin.js')
; ;
module.exports = Encore.getWebpackConfig(); module.exports = Encore.getWebpackConfig();