From 4d7900457086ef191f26c895f62fff00c2231c99 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Wed, 16 Nov 2016 12:00:21 +0200 Subject: [PATCH] source/scss: Only import parts of font-awesome that we actually need We can save ~30KiB in our stylesheet by only importing font-awesome features and icons that we are actually using. --- source/scss/font-awesome.scss | 26 ++++++++++++++++++++++++++ source/scss/style.scss | 4 +++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 source/scss/font-awesome.scss diff --git a/source/scss/font-awesome.scss b/source/scss/font-awesome.scss new file mode 100644 index 0000000..f58bd83 --- /dev/null +++ b/source/scss/font-awesome.scss @@ -0,0 +1,26 @@ +/*! + * Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */ + +@import "node_modules/font-awesome/scss/variables"; +@import "node_modules/font-awesome/scss/mixins"; +@import "node_modules/font-awesome/scss/path"; +@import "node_modules/font-awesome/scss/core"; +@import "node_modules/font-awesome/scss/larger"; +@import "node_modules/font-awesome/scss/fixed-width"; +//@import "list"; +//@import "bordered-pulled"; +//@import "animated"; +//@import "rotated-flipped"; +//@import "stacked"; +//@import "icons"; +// selectively import icons we need from font-awesome +// see: node_modules/font-awesome/scss/_icons.scss +.#{$fa-css-prefix}-tag:before { content: $fa-var-tag; } +.#{$fa-css-prefix}-folder:before { content: $fa-var-folder; } +.#{$fa-css-prefix}-facebook:before { content: $fa-var-facebook; } +.#{$fa-css-prefix}-google-plus:before { content: $fa-var-google-plus; } +.#{$fa-css-prefix}-linkedin:before { content: $fa-var-linkedin; } +.#{$fa-css-prefix}-twitter:before { content: $fa-var-twitter; } +@import "node_modules/font-awesome/scss/screen-reader"; diff --git a/source/scss/style.scss b/source/scss/style.scss index 342151b..38e4abf 100644 --- a/source/scss/style.scss +++ b/source/scss/style.scss @@ -5,7 +5,9 @@ $enable-grid-classes: true; // optional: import local styles first @import 'source/scss/main.scss'; -@import 'node_modules/font-awesome/scss/font-awesome.scss'; +// selectively import components we need from font-awesome +// see: node_modules/font-awesome/scss/font-awesome.scss +@import 'source/scss/font-awesome.scss'; // selectively import components we need from bootstrap // see: node_modules/bootstrap/scss/bootstrap.scss