Switch from Laravel Mix to Webpack Encore
- Updated npm dependencies - Replaced `webpack.mix.js` with `webpack.config.js` - Added `postcss.config.js` - Removed the `src` directory and moved `css` and `js` to the root level of the theme - Renamed `dist` to `build` and updated in libraries file References #41
This commit is contained in:
parent
e4da12188e
commit
d343b4cdf2
3
web/themes/custom/opdavies/.gitignore
vendored
3
web/themes/custom/opdavies/.gitignore
vendored
|
@ -1,6 +1,5 @@
|
|||
/*.log
|
||||
/mix-manifest.json
|
||||
/node_modules/
|
||||
|
||||
# Ignore compiled assets.
|
||||
# /dist/
|
||||
/build/
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import '../css/tailwind.pcss'
|
||||
import 'alpinejs'
|
||||
import hljs from 'highlightjs'
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
global-styling:
|
||||
css:
|
||||
base:
|
||||
dist/tailwind.css: {}
|
||||
build/app.css: {}
|
||||
|
||||
global-scripts:
|
||||
js:
|
||||
dist/js/app.js: {}
|
||||
build/app.js: {}
|
||||
|
||||
twitter:
|
||||
js:
|
||||
|
|
11085
web/themes/custom/opdavies/package-lock.json
generated
11085
web/themes/custom/opdavies/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,23 +1,18 @@
|
|||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "npm run dev",
|
||||
"dev": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||
"development": "npm run dev",
|
||||
"prod": "npm run production",
|
||||
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
|
||||
"dev": "encore dev",
|
||||
"prod": "NODE_ENV=production encore production",
|
||||
"watch": "encore dev --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^9.7.6",
|
||||
"cross-env": "^5.2.0",
|
||||
"@symfony/webpack-encore": "^0.30.2",
|
||||
"alpinejs": "^2.3.5",
|
||||
"autoprefixer": "^9.8.0",
|
||||
"highlightjs": "^9.16.2",
|
||||
"laravel-mix": "^2.1.14",
|
||||
"postcss-import": "^12.0.1",
|
||||
"postcss-loader": "^3.0.0",
|
||||
"postcss-nested": "^4.2.1",
|
||||
"tailwindcss": "^1.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"alpinejs": "^2.3.5"
|
||||
"tailwindcss": "^1.4.6"
|
||||
}
|
||||
}
|
||||
|
|
8
web/themes/custom/opdavies/postcss.config.js
Normal file
8
web/themes/custom/opdavies/postcss.config.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
module.exports = {
|
||||
plugins: [
|
||||
require('postcss-import'),
|
||||
require('tailwindcss'),
|
||||
require('postcss-nested'),
|
||||
require('autoprefixer')
|
||||
]
|
||||
}
|
17
web/themes/custom/opdavies/webpack.config.js
Normal file
17
web/themes/custom/opdavies/webpack.config.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
let Encore = require('@symfony/webpack-encore')
|
||||
|
||||
Encore
|
||||
.disableSingleRuntimeChunk()
|
||||
.cleanupOutputBeforeBuild()
|
||||
.setOutputPath('build/')
|
||||
.setPublicPath('/themes/custom/opdavies/build')
|
||||
|
||||
.addEntry('app', './js/app.js')
|
||||
|
||||
.enablePostCssLoader()
|
||||
|
||||
if (!Encore.isProduction()) {
|
||||
Encore.enableSourceMaps()
|
||||
}
|
||||
|
||||
module.exports = Encore.getWebpackConfig()
|
|
@ -1,10 +0,0 @@
|
|||
let mix = require('laravel-mix');
|
||||
|
||||
mix.postCss('src/tailwind.pcss', 'dist', [
|
||||
require('postcss-import'),
|
||||
require('tailwindcss'),
|
||||
require('postcss-nested'),
|
||||
require('autoprefixer')
|
||||
])
|
||||
|
||||
mix.js('src/app.js', 'dist/js')
|
Loading…
Reference in a new issue