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:
Oliver Davies 2020-06-10 12:03:39 +01:00
parent e4da12188e
commit d343b4cdf2
22 changed files with 4880 additions and 6269 deletions

View file

@ -1,6 +1,5 @@
/*.log
/mix-manifest.json
/node_modules/
# Ignore compiled assets.
# /dist/
/build/

View file

@ -1,3 +1,4 @@
import '../css/tailwind.pcss'
import 'alpinejs'
import hljs from 'highlightjs'

View file

@ -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:

File diff suppressed because it is too large Load diff

View file

@ -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"
}
}

View file

@ -0,0 +1,8 @@
module.exports = {
plugins: [
require('postcss-import'),
require('tailwindcss'),
require('postcss-nested'),
require('autoprefixer')
]
}

View 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()

View file

@ -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')