Skip to content

Commit 3054c92

Browse files
committed
font-awesome via npm instead of CDN
1 parent 8e0d0c7 commit 3054c92

File tree

6 files changed

+57
-37
lines changed

6 files changed

+57
-37
lines changed

build/webpack.config.js

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
var webpack = require('webpack');
2-
var path = require('path');
3-
var glob = require('glob');
4-
var ExtractTextPlugin = require('extract-text-webpack-plugin');
5-
var CleanWebpackPlugin = require('clean-webpack-plugin');
6-
var ManifestPlugin = require('webpack-manifest-plugin');
7-
var BrowserSyncPlugin = require('browser-sync-webpack-plugin');
8-
var config = require('./config');
9-
var inProduction = process.env.NODE_ENV === 'production';
10-
var styleHash = inProduction ? 'contenthash' : 'hash';
11-
var scriptHash = inProduction ? 'chunkhash' : 'hash';
1+
const webpack = require('webpack');
2+
const path = require('path');
3+
const glob = require('glob');
4+
const ExtractTextPlugin = require('extract-text-webpack-plugin');
5+
const CleanWebpackPlugin = require('clean-webpack-plugin');
6+
const ManifestPlugin = require('webpack-manifest-plugin');
7+
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
8+
const config = require('./config');
9+
10+
const inProduction = process.env.NODE_ENV === 'production';
11+
const styleHash = inProduction ? 'contenthash' : 'hash';
12+
const scriptHash = inProduction ? 'chunkhash' : 'hash';
1213

1314
module.exports = {
1415
entry: {
@@ -31,16 +32,12 @@ module.exports = {
3132
// Since sass-loader (weirdly) has SCSS as its default parse mode, we map
3233
// the "scss" and "sass" values for the lang attribute to the right configs here.
3334
// other preprocessors should work out of the box, no loader config like this necessary.
34-
'scss': [
35+
scss: ['vue-style-loader', 'css-loader', 'sass-loader'],
36+
sass: [
3537
'vue-style-loader',
3638
'css-loader',
37-
'sass-loader'
39+
'sass-loader?indentedSyntax',
3840
],
39-
'sass': [
40-
'vue-style-loader',
41-
'css-loader',
42-
'sass-loader?indentedSyntax'
43-
]
4441
},
4542
// other vue-loader options go here
4643
},
@@ -56,7 +53,7 @@ module.exports = {
5653
},
5754
{
5855
loader: 'sass-loader',
59-
options: { sourceMap: true, },
56+
options: { sourceMap: true },
6057
},
6158
],
6259
}),
@@ -74,19 +71,29 @@ module.exports = {
7471
options: {
7572
name: '[name].[ext]',
7673
outputPath: 'images/',
77-
publicPath: config.assetsPath + 'static/',
74+
publicPath: `${config.assetsPath}static/`,
7875
},
7976
},
8077
'image-webpack-loader',
8178
],
8279
},
80+
{
81+
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
82+
loader: 'url-loader',
83+
options: {
84+
limit: 10000,
85+
name: '[name].[hash:7].[ext]',
86+
outputPath: 'fonts/',
87+
publicPath: `${config.assetsPath}static/`,
88+
},
89+
},
8390
],
8491
},
8592

8693
resolve: {
8794
alias: {
88-
'vue$': 'vue/dist/vue.esm.js',
89-
'images': path.join(__dirname, '../resources/assets/images'),
95+
vue$: 'vue/dist/vue.esm.js',
96+
images: path.join(__dirname, '../resources/assets/images'),
9097
},
9198
extensions: ['*', '.js', '.vue', '.json'],
9299
},
@@ -98,14 +105,10 @@ module.exports = {
98105
host: 'localhost',
99106
port: 3000,
100107
proxy: config.devUrl, // YOUR DEV-SERVER URL
101-
files: [
102-
'../*.php',
103-
'../resources/views/*.twig',
104-
'../static/*.*',
105-
],
108+
files: ['../*.php', '../resources/views/*.twig', '../static/*.*'],
106109
}),
107110

108-
new CleanWebpackPlugin(['static/css/*', 'static/js/*'], {
111+
new CleanWebpackPlugin(['static/css/*', 'static/js/*', 'static/fonts/*'], {
109112
watch: true,
110113
root: path.resolve(__dirname, '../'),
111114
}),
@@ -122,10 +125,8 @@ if (inProduction) {
122125
module.exports.plugins.push(new webpack.optimize.UglifyJsPlugin());
123126

124127
module.exports.plugins.push(new webpack.DefinePlugin({
125-
'process.env': {
126-
NODE_ENV: '"production"'
127-
}
128-
})
129-
);
130-
128+
'process.env': {
129+
NODE_ENV: '"production"',
130+
},
131+
}));
131132
}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@
2929
"eslint-plugin-vue": "^2.1.0",
3030
"extract-text-webpack-plugin": "^3.0.0",
3131
"file-loader": "^0.11.2",
32+
"font-awesome": "^4.7.0",
3233
"image-webpack-loader": "^3.4.2",
3334
"node-sass": "^4.5.3",
3435
"prettier-eslint": "^8.2.2",
3536
"sass-loader": "^6.0.6",
3637
"style-loader": "^0.19.0",
38+
"url-loader": "^0.6.2",
3739
"vue-loader": "^13.0.4",
3840
"vue-template-compiler": "^2.3.3",
3941
"webpack": "^3.4.1",

resources/assets/sass/_variables.sass

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ $red: $bc-secondary
1111

1212
// HELPER URL
1313
$images: '../images'
14+
15+
// FONT-AWESOME FONT PATH
16+
$fa-font-path: "../../../node_modules/font-awesome/fonts"

resources/assets/sass/main.sass

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@import "variables"
22
@import "node_modules/bulma/bulma"
3+
@import "node_modules/font-awesome/scss/font-awesome"
34
@import "pageloader"
45
@import "components/index"
56
@import "footer"

resources/views/header/_head.twig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,5 @@
2727

2828
<link rel="pingback" href="{{ site.pingback_url }}"/>
2929

30-
{# TEMPORARY FROM CDN #}
31-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
32-
3330
{{ function('wp_head') }}
3431
</head>

yarn.lock

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2585,6 +2585,10 @@ flatten@^1.0.2:
25852585
version "1.0.2"
25862586
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782"
25872587

2588+
font-awesome@^4.7.0:
2589+
version "4.7.0"
2590+
resolved "https://registry.yarnpkg.com/font-awesome/-/font-awesome-4.7.0.tgz#8fa8cf0411a1a31afd07b06d2902bb9fc815a133"
2591+
25882592
for-in@^0.1.3:
25892593
version "0.1.8"
25902594
resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.8.tgz#d8773908e31256109952b1fdb9b3fa867d2775e1"
@@ -4147,6 +4151,10 @@ mime@1.3.4:
41474151
version "2.0.3"
41484152
resolved "https://registry.yarnpkg.com/mime/-/mime-2.0.3.tgz#4353337854747c48ea498330dc034f9f4bbbcc0b"
41494153

4154+
mime@^1.4.1:
4155+
version "1.6.0"
4156+
resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
4157+
41504158
mimic-fn@^1.0.0:
41514159
version "1.1.0"
41524160
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18"
@@ -6276,6 +6284,14 @@ unzip-response@^1.0.2:
62766284
version "1.0.2"
62776285
resolved "https://registry.yarnpkg.com/unzip-response/-/unzip-response-1.0.2.tgz#b984f0877fc0a89c2c773cc1ef7b5b232b5b06fe"
62786286

6287+
url-loader@^0.6.2:
6288+
version "0.6.2"
6289+
resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-0.6.2.tgz#a007a7109620e9d988d14bce677a1decb9a993f7"
6290+
dependencies:
6291+
loader-utils "^1.0.2"
6292+
mime "^1.4.1"
6293+
schema-utils "^0.3.0"
6294+
62796295
url-parse-lax@^1.0.0:
62806296
version "1.0.0"
62816297
resolved "https://registry.yarnpkg.com/url-parse-lax/-/url-parse-lax-1.0.0.tgz#7af8f303645e9bd79a272e7a14ac68bc0609da73"

0 commit comments

Comments
 (0)