Add webpack aliases for CSS and JS directories

This commit is contained in:
Oliver Davies 2020-06-16 00:07:39 +01:00
parent 0215e31154
commit deb6f26836
2 changed files with 8 additions and 2 deletions

View file

@ -1,5 +1,5 @@
import '../css/tailwind.pcss'
import 'alpinejs'
import 'styles/tailwind.pcss'
import hljs from 'highlightjs'
document.addEventListener('DOMContentLoaded', event => {

View file

@ -1,4 +1,5 @@
let Encore = require('@symfony/webpack-encore')
let path = require('path')
Encore
.disableSingleRuntimeChunk()
@ -6,10 +7,15 @@ Encore
.setOutputPath('build/')
.setPublicPath('/themes/custom/opdavies/build')
.addEntry('app', './assets/js/app.js')
.addEntry('app', '@/app.js')
.enablePostCssLoader()
.addAliases({
'@': path.resolve(__dirname, 'assets', 'js'),
styles: path.resolve(__dirname, 'assets', 'css')
})
if (!Encore.isProduction()) {
Encore.enableSourceMaps()
}