Implement autoload system for styles/scripts
This commit is contained in:
@@ -11,7 +11,6 @@ const CopyGlobsPlugin = require('copy-globs-webpack-plugin');
|
||||
const config = require('./config');
|
||||
|
||||
const assetsFilenames = (config.enabled.cacheBusting) ? config.cacheBusting : '[name]';
|
||||
const sourceMapQueryStr = (config.enabled.sourceMaps) ? '+sourceMap' : '-sourceMap';
|
||||
|
||||
let webpackConfig = {
|
||||
context: config.paths.assets,
|
||||
@@ -26,10 +25,16 @@ let webpackConfig = {
|
||||
rules: [
|
||||
{
|
||||
enforce: 'pre',
|
||||
test: /\.js?$/,
|
||||
test: /\.js$/,
|
||||
include: config.paths.assets,
|
||||
use: 'eslint',
|
||||
},
|
||||
{
|
||||
enforce: 'pre',
|
||||
test: /\.(js|s?[ca]ss)$/,
|
||||
include: config.paths.assets,
|
||||
loader: 'import-glob',
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: [/(node_modules|bower_components)(?)/],
|
||||
|
||||
1
resources/assets/scripts/autoload/_bootstrap.js
Normal file
1
resources/assets/scripts/autoload/_bootstrap.js
Normal file
@@ -0,0 +1 @@
|
||||
import 'bootstrap';
|
||||
@@ -1,6 +1,8 @@
|
||||
// import external dependencies
|
||||
import 'jquery';
|
||||
import 'bootstrap';
|
||||
|
||||
// Import everything from autoload
|
||||
import "./autoload/**/*"
|
||||
|
||||
// import local dependencies
|
||||
import Router from './util/Router';
|
||||
|
||||
1
resources/assets/styles/autoload/_bootstrap.scss
Normal file
1
resources/assets/styles/autoload/_bootstrap.scss
Normal file
@@ -0,0 +1 @@
|
||||
@import "~bootstrap/scss/bootstrap";
|
||||
@@ -1,12 +1,15 @@
|
||||
@import "common/variables";
|
||||
|
||||
/** Import everything from autoload */
|
||||
@import "./autoload/**/*";
|
||||
|
||||
/**
|
||||
* Import npm dependencies
|
||||
*
|
||||
* Prefix your imports with `~` to grab from node_modules/
|
||||
* @see https://github.com/webpack-contrib/sass-loader#imports
|
||||
*/
|
||||
@import "~bootstrap/scss/bootstrap";
|
||||
// @import "~some-node-module";
|
||||
|
||||
/** Import theme styles */
|
||||
@import "common/global";
|
||||
|
||||
Reference in New Issue
Block a user