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
|
/*.log
|
||||||
/mix-manifest.json
|
|
||||||
/node_modules/
|
/node_modules/
|
||||||
|
|
||||||
# Ignore compiled assets.
|
# Ignore compiled assets.
|
||||||
# /dist/
|
/build/
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import '../css/tailwind.pcss'
|
||||||
import 'alpinejs'
|
import 'alpinejs'
|
||||||
import hljs from 'highlightjs'
|
import hljs from 'highlightjs'
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
global-styling:
|
global-styling:
|
||||||
css:
|
css:
|
||||||
base:
|
base:
|
||||||
dist/tailwind.css: {}
|
build/app.css: {}
|
||||||
|
|
||||||
global-scripts:
|
global-scripts:
|
||||||
js:
|
js:
|
||||||
dist/js/app.js: {}
|
build/app.js: {}
|
||||||
|
|
||||||
twitter:
|
twitter:
|
||||||
js:
|
js:
|
||||||
|
|
11115
web/themes/custom/opdavies/package-lock.json
generated
11115
web/themes/custom/opdavies/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,23 +1,18 @@
|
||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npm run dev",
|
"dev": "encore 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",
|
"prod": "NODE_ENV=production encore production",
|
||||||
"development": "npm run dev",
|
"watch": "encore dev --watch"
|
||||||
"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"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"autoprefixer": "^9.7.6",
|
"@symfony/webpack-encore": "^0.30.2",
|
||||||
"cross-env": "^5.2.0",
|
"alpinejs": "^2.3.5",
|
||||||
|
"autoprefixer": "^9.8.0",
|
||||||
"highlightjs": "^9.16.2",
|
"highlightjs": "^9.16.2",
|
||||||
"laravel-mix": "^2.1.14",
|
|
||||||
"postcss-import": "^12.0.1",
|
"postcss-import": "^12.0.1",
|
||||||
|
"postcss-loader": "^3.0.0",
|
||||||
"postcss-nested": "^4.2.1",
|
"postcss-nested": "^4.2.1",
|
||||||
"tailwindcss": "^1.0.1"
|
"tailwindcss": "^1.4.6"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"alpinejs": "^2.3.5"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
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