Skip to content

Instantly share code, notes, and snippets.

@jahid32
Forked from carlosbensant/webpack.mix.js
Created October 26, 2018 05:08
Show Gist options
  • Save jahid32/ce04aea07ceea203c2b85e9ebfe0df5b to your computer and use it in GitHub Desktop.
Save jahid32/ce04aea07ceea203c2b85e9ebfe0df5b to your computer and use it in GitHub Desktop.
Using Webpack/Laravel-Mix to bundle/compile Drupal 8 Theme assets.
const { mix } = require('laravel-mix')
const path = require('path')
/*
|--------------------------------------------------------------------------
| Asset Management
|--------------------------------------------------------------------------
|
| This file defines the building steps of the application. Here's where the
| client-side technologies are configured according to the needs. Steps such
| as JSX or SASS processing also happens here.
|
| In our case, we're using laravel mix to manage most of the hassle of manually
| setting theses rules. We're also using a custom webpack config which allows
| us to add any additional babel plugin that we may need (such as babel decorators).
|
*/
mix
.browserSync({
open: false,
proxy: 'drupal8theming.test',
notify: false,
stream: true,
files: [
'style.css',
'js/{*,**/*}.js',
'{*,**/*}.php'
]
})
.options({
processCssUrls: false
})
.webpackConfig({
resolve: {
modules: [
path.resolve('./assets/scripts'),
path.resolve('./node_modules')
],
}
})
.sass('assets/scss/application.scss', 'css/application.css')
.js('assets/scripts/application.js', 'js/application.js')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment