Add Webpack Encore
This commit is contained in:
parent
6f059590cb
commit
70667da418
40
package.json
40
package.json
|
@ -1,38 +1,14 @@
|
||||||
{
|
{
|
||||||
"config": {
|
"devDependencies": {
|
||||||
"jsPath": "assets/js",
|
"@symfony/webpack-encore": "^0.17.1",
|
||||||
"lessPath": "assets/less",
|
"autoprefixer": "^7.2.4",
|
||||||
"outputCss": "source/assets/css",
|
|
||||||
"outputFonts": "source/assets/fonts",
|
|
||||||
"outputJs": "source/assets/js"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"build": "npm run init && npm-run-all -p build:css build:js copy:fonts",
|
|
||||||
"build:css": "npm run less -- && npm run postcss",
|
|
||||||
"build:js": "concat -o $npm_package_config_outputJs/site.js node_modules/jquery/dist/jquery.js node_modules/highlightjs/highlight.pack.js $npm_package_config_jsPath/vendor/*.js $npm_package_config_jsPath/main.js",
|
|
||||||
"copy:fonts": "cp -R node_modules/font-awesome/fonts/* $npm_package_config_outputFonts",
|
|
||||||
"dev": "npm run build && npm-run-all -p watch:css watch:js",
|
|
||||||
"init": "mkdir -p $npm_package_config_outputCss $npm_package_config_outputFonts $npm_package_config_outputJs",
|
|
||||||
"less": "lessc --npm-import='prefix=~' $npm_package_config_lessPath/main.less $npm_package_config_outputCss/site.css",
|
|
||||||
"postcss": "postcss -c postcss.config.js -r $npm_package_config_outputCss/*.css",
|
|
||||||
"prod": "npm run build",
|
|
||||||
"watch": "npm-run-all -p watch:css watch:js",
|
|
||||||
"watch:css": "onchange $npm_package_config_lessPath -v -- npm-run-all -p build:css",
|
|
||||||
"watch:js": "onchange $npm_package_config_jsPath -v -- npm-run-all -p build:js"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"autoprefixer": "^7.1.5",
|
|
||||||
"concat": "^1.0.3",
|
|
||||||
"font-awesome": "^4.7.0",
|
"font-awesome": "^4.7.0",
|
||||||
"graceful-fs": "^4.1.11",
|
|
||||||
"highlightjs": "^9.10.0",
|
"highlightjs": "^9.10.0",
|
||||||
"jquery.2": "^1.0.0",
|
"less": "^2.7.3",
|
||||||
"less": "2.7.1",
|
"less-loader": "^4.0.5",
|
||||||
"less-plugin-clean-css": "^1.5.1",
|
|
||||||
"less-plugin-npm-import": "^2.1.0",
|
"less-plugin-npm-import": "^2.1.0",
|
||||||
"npm-run-all": "^4.1.1",
|
"postcss-loader": "^2.0.10",
|
||||||
"onchange": "^3.2.1",
|
"tailwindcss": "^0.4.0",
|
||||||
"postcss-cli": "^4.1.1",
|
"webpack-notifier": "^1.5.0"
|
||||||
"tailwindcss": "^0.1.4"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
20
webpack.config.js
Normal file
20
webpack.config.js
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
var Encore = require('@symfony/webpack-encore');
|
||||||
|
|
||||||
|
Encore
|
||||||
|
.setOutputPath('source/build/')
|
||||||
|
.setPublicPath('/build')
|
||||||
|
.cleanupOutputBeforeBuild()
|
||||||
|
.enableLessLoader()
|
||||||
|
.addEntry('js/site', './assets/js/main.js')
|
||||||
|
.addStyleEntry('css/site', './assets/less/main.less')
|
||||||
|
.enablePostCssLoader(function(options) {
|
||||||
|
options.config = {
|
||||||
|
path: 'config/postcss.config.js'
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.enableSourceMaps(!Encore.isProduction())
|
||||||
|
.enableVersioning(false)
|
||||||
|
.enableBuildNotifications()
|
||||||
|
;
|
||||||
|
|
||||||
|
module.exports = Encore.getWebpackConfig();
|
Loading…
Reference in a new issue