Implement autoload system for styles/scripts
This commit is contained in:
14
package-lock.json
generated
14
package-lock.json
generated
@@ -4066,6 +4066,20 @@
|
||||
"integrity": "sha1-IAgH8Rqw9ycQ6khVQt4IgHX2jNI=",
|
||||
"dev": true
|
||||
},
|
||||
"import-glob": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/import-glob/-/import-glob-1.5.0.tgz",
|
||||
"integrity": "sha1-W43El8exriQG2kHKaHuzs0Inplk=",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"glob": {
|
||||
"version": "5.0.15",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz",
|
||||
"integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"imurmurhash": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
|
||||
|
||||
@@ -103,6 +103,7 @@
|
||||
"file-loader": "~1.0.0-beta.1",
|
||||
"imagemin-mozjpeg": "~6.0",
|
||||
"imagemin-webpack-plugin": "~1.5.0-beta.0",
|
||||
"import-glob": "~1.5",
|
||||
"node-sass": "~4.5",
|
||||
"optimize-css-assets-webpack-plugin": "~2.0",
|
||||
"postcss-loader": "~2.0",
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -2409,7 +2409,7 @@ glob-stream@^5.3.2:
|
||||
to-absolute-glob "^0.1.1"
|
||||
unique-stream "^2.0.2"
|
||||
|
||||
glob@^5.0.3:
|
||||
glob@^5.0.13, glob@^5.0.3:
|
||||
version "5.0.15"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1"
|
||||
dependencies:
|
||||
@@ -2816,6 +2816,12 @@ immutable@3.8.1, immutable@^3.7.6:
|
||||
version "3.8.1"
|
||||
resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.8.1.tgz#200807f11ab0f72710ea485542de088075f68cd2"
|
||||
|
||||
import-glob@~1.5:
|
||||
version "1.5.0"
|
||||
resolved "https://registry.yarnpkg.com/import-glob/-/import-glob-1.5.0.tgz#5b8dc497c7b1ae2406da41ca687bb3b34227a659"
|
||||
dependencies:
|
||||
glob "^5.0.13"
|
||||
|
||||
imurmurhash@^0.1.4:
|
||||
version "0.1.4"
|
||||
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
|
||||
|
||||
Reference in New Issue
Block a user