Created
April 18, 2018 15:26
-
-
Save carlosbensant/d6b8336e67a0b71877d923a4771f519b to your computer and use it in GitHub Desktop.
Using Webpack/Laravel-Mix to bundle/compile Drupal 8 Theme assets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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