Squashing asset pipeline bugs and other stuff

1. Update dependencies
   - Add font-awesome as dependency
   - Switch to Bootstrap 4 dev branch
   - Remove eslint airbnb style (we're not using it)

2. Imported images and fonts should go into dist/images
   and dist/fonts, respectively

3. Only lint our own code, not external code (fixes #1633)
This commit is contained in:
QWp6t
2016-08-13 07:37:14 -07:00
parent 447c24d082
commit 4d58f88166
6 changed files with 24 additions and 21 deletions

View File

@@ -2,7 +2,7 @@
"root": true,
"extends": "eslint:recommended",
"globals": {
"wp": true,
"wp": true
},
"env": {
"browser": true,

View File

@@ -1,12 +1,13 @@
import $ from 'jquery';
// import external dependencies
import 'jquery'
import 'bootstrap/dist/js/bootstrap'
// import local dependencies
import Router from './util/router';
import common from './routes/Common';
import home from './routes/Home';
import about_us from './routes/About';
// Import npm dependencies
import 'bootstrap/dist/js/bootstrap';
// Use this variable to set up the common and page specific functions. If you
// rename this variable, you will also need to rename the namespace below.
const routes = {

View File

@@ -5,3 +5,6 @@ $sidebar-sm-columns: 4;
// Colors
$brand-primary: #27ae60;
// Font Awesome | see: http://fontawesome.io/get-started/
$fa-font-path: '~font-awesome/fonts';

View File

@@ -2,6 +2,7 @@
// Import npm dependencies
@import "~bootstrap/scss/bootstrap";
@import "~font-awesome/scss/font-awesome";
@import "common/global";
@import "components/buttons";

View File

@@ -21,8 +21,7 @@
"build:production": "webpack -p --progress --release",
"build": "webpack -d --progress",
"watch": "node watch.js --watch",
"lint": "eslint -c .eslintrc assets/scripts watch.js webpack.config.js",
"install": "composer install"
"lint": "eslint -c .eslintrc assets/scripts watch.js webpack.config.js"
},
"engines": {
"node": ">=4"
@@ -34,15 +33,15 @@
"babel-core": "^6.7.4",
"babel-eslint": "^6.0.0",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.1.18",
"babel-preset-es2015": "^6.13.2",
"babel-register": "^6.5.2",
"babel-runtime": "^6.5.0",
"body-parser": "^1.14.1",
"browser-sync": "^2.11.2",
"clean-webpack-plugin": "^0.1.8",
"css-loader": "^0.23.1",
"cssnano": "^3.5.2",
"eslint": "^3.2.2",
"eslint-config-airbnb": "^10.0.0",
"eslint-loader": "^1.3.0",
"eslint-plugin-react": "^6.0.0",
"extract-text-webpack-plugin": "^1.0.1",
@@ -66,9 +65,8 @@
"webpack-hot-middleware": "^2.10.0"
},
"dependencies": {
"babel-runtime": "^6.5.0",
"bootstrap": "^4.0.0-alpha.3",
"jquery": "^2.1.4",
"tether": "^1.2.0"
"bootstrap": "github:twbs/bootstrap#v4-dev",
"font-awesome": "^4.6.3",
"jquery": "^1.12.4"
}
}

View File

@@ -22,8 +22,8 @@ var scriptsFilename = (argv.release) ? 'scripts/[name]_[hash].js' : 'scripts/[na
jsLoader = {
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loaders: [ 'babel?presets[]=es2015&cacheDirectory' ]
exclude: [ /(node_modules|bower_components)(?![/|\\](bootstrap|foundation-sites))/ ],
loaders: [ 'babel?presets[]='+path.resolve('./node_modules/babel-preset-es2015')+'&cacheDirectory' ]
};
if (argv.watch) { // '--watch' to add monkey-hot
@@ -53,7 +53,7 @@ var assetsPluginProcessOutput = function (assets) {
}
}
return JSON.stringify(results);
}
};
/**
* Loop through webpack entry
@@ -80,7 +80,7 @@ var addHotMiddleware = function (entry) {
}
}
return results;
}
};
webpackConfig = {
context: path.resolve(config.context),
@@ -94,7 +94,7 @@ webpackConfig = {
preLoaders: [
{
test: /\.js?$/,
exclude: /(node_modules|bower_components)/,
include: path.resolve('assets'),
loader: 'eslint'
}
],
@@ -120,7 +120,7 @@ webpackConfig = {
test: /\.(png|jpg|jpeg|gif)(\?.*)?$/,
loaders: [
'file?' + qs.stringify({
name: '[path][name].[ext]'
name: 'images/[name]_[md5:hash:hex:8].[ext]'
}),
'image-webpack?' + JSON.stringify({
bypassOnDebug:true,
@@ -141,7 +141,7 @@ webpackConfig = {
{
test: /\.(ttf|eot|svg)(\?.*)?$/,
loader: 'file?' + qs.stringify({
name: '[path][name].[ext]'
name: 'fonts/[name]_[md5:hash:hex:8].[ext]'
})
},
{
@@ -149,7 +149,7 @@ webpackConfig = {
loader: 'url?' + qs.stringify({
limit: 10000,
mimetype: "application/font-woff",
name: "[path][name].[ext]"
name: "fonts/[name]_[md5:hash:hex:8].[ext]"
})
}
]