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, "root": true,
"extends": "eslint:recommended", "extends": "eslint:recommended",
"globals": { "globals": {
"wp": true, "wp": true
}, },
"env": { "env": {
"browser": true, "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 Router from './util/router';
import common from './routes/Common'; import common from './routes/Common';
import home from './routes/Home'; import home from './routes/Home';
import about_us from './routes/About'; 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 // 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. // rename this variable, you will also need to rename the namespace below.
const routes = { const routes = {

View File

@@ -5,3 +5,6 @@ $sidebar-sm-columns: 4;
// Colors // Colors
$brand-primary: #27ae60; $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 npm dependencies
@import "~bootstrap/scss/bootstrap"; @import "~bootstrap/scss/bootstrap";
@import "~font-awesome/scss/font-awesome";
@import "common/global"; @import "common/global";
@import "components/buttons"; @import "components/buttons";

View File

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

View File

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