From f6e602e4eafb06bbf02e5580d9c7478d25ae0b6f Mon Sep 17 00:00:00 2001 From: Corey Sewell Date: Thu, 24 Sep 2015 13:27:42 +1200 Subject: Fix google font import issue with scss --- Gruntfile.js | 19 ++++++++++++------- cosmo/_bootswatch.scss | 5 +---- cyborg/_bootswatch.scss | 5 +---- darkly/_bootswatch.scss | 5 +---- flatly/_bootswatch.scss | 5 +---- journal/_bootswatch.scss | 5 +---- lumen/_bootswatch.scss | 5 +---- paper/_bootswatch.scss | 5 +---- readable/_bootswatch.scss | 5 +---- sandstone/_bootswatch.scss | 5 +---- simplex/_bootswatch.scss | 5 +---- spacelab/_bootswatch.scss | 5 +---- superhero/_bootswatch.scss | 5 +---- united/_bootswatch.scss | 5 +---- yeti/_bootswatch.scss | 5 +---- 15 files changed, 26 insertions(+), 63 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 0b209329..392e7e53 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -199,10 +199,10 @@ grunt.registerTask('build_scss', 'build a regular theme from scss', function(the grunt.config('buildtheme', theme); }); - /** - * Regex borrowed form - * https://gist.github.com/rosskevin/ddfe895091de2ca5f931 - * */ + /** + * Regex borrowed form + * https://gist.github.com/rosskevin/ddfe895091de2ca5f931 + * */ grunt.registerTask('convert_less', 'Convert less to scss using regular expression', function () { var convertBaseDir = ''; grunt.file.expand(convertBaseDir + '*/*.less').forEach(function (lessFile) { @@ -233,11 +233,16 @@ grunt.registerTask('build_scss', 'build a regular theme from scss', function(the // 11. replace icon-font-path value with conditional for asset helpers .replace(/(\$icon-font-path:).*;/g, '$1 if($bootstrap-sass-asset-helper, "bootstrap/", "../fonts/bootstrap/");') // 12. set bootswatch's web-font-path value as !default - .replace(/(\$web-font-path:.*);/g, '$1 !default;'); + .replace(/(\$web-font-path:.*);/g, '$1 !default;') + // 13. Remove the web-font mixin which breaks in libsass + .replace(/[\s\S][\s\S]@mixin web-font.*([\s\S]*?).*;([\s\S]*?)}([\s\S]*?)/,"") + // 14. Replace usage of the web-font mixin with variable interpolation + .replace(/@include web-font/,'@import url'); + if (/\/variables.less$/.test(lessFile)) { - // 13. set default value of $bootstrap-sass-asset-helper to false + // 15. set default value of $bootstrap-sass-asset-helper to false out = "$bootstrap-sass-asset-helper: false;\n" + out; - // 14. only assign variables if they haven't been previously set e.g. $var: #f00; > $var: #f00 !default; + // 16. only assign variables if they haven't been previously set e.g. $var: #f00; > $var: #f00 !default; out = out.replace(/^(\$.*);/gm, '$1 !default;'); } diff --git a/cosmo/_bootswatch.scss b/cosmo/_bootswatch.scss index e8da4309..e27dd81d 100644 --- a/cosmo/_bootswatch.scss +++ b/cosmo/_bootswatch.scss @@ -4,10 +4,7 @@ $web-font-path: "https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700" !default; -@mixin web-font($path){ - @import url("#{$path}"); -} -@include web-font($web-font-path); +@import url($web-font-path); // Navbar ===================================================================== diff --git a/cyborg/_bootswatch.scss b/cyborg/_bootswatch.scss index 9147ae20..3b696a08 100644 --- a/cyborg/_bootswatch.scss +++ b/cyborg/_bootswatch.scss @@ -4,10 +4,7 @@ $web-font-path: "https://fonts.googleapis.com/css?family=Roboto:400,700" !default; -@mixin web-font($path){ - @import url("#{$path}"); -} -@include web-font($web-font-path); +@import url($web-font-path); // Navbar ===================================================================== diff --git a/darkly/_bootswatch.scss b/darkly/_bootswatch.scss index 99a1a1e6..0c4617f4 100644 --- a/darkly/_bootswatch.scss +++ b/darkly/_bootswatch.scss @@ -4,10 +4,7 @@ $web-font-path: "https://fonts.googleapis.com/css?family=Lato:400,700,400italic" !default; -@mixin web-font($path){ - @import url("#{$path}"); -} -@include web-font($web-font-path); +@import url($web-font-path); // Navbar ===================================================================== diff --git a/flatly/_bootswatch.scss b/flatly/_bootswatch.scss index 7e42b1d9..c5a63aed 100644 --- a/flatly/_bootswatch.scss +++ b/flatly/_bootswatch.scss @@ -4,10 +4,7 @@ $web-font-path: "https://fonts.googleapis.com/css?family=Lato:400,700,400italic" !default; -@mixin web-font($path){ - @import url("#{$path}"); -} -@include web-font($web-font-path); +@import url($web-font-path); // Navbar ===================================================================== diff --git a/journal/_bootswatch.scss b/journal/_bootswatch.scss index 66d47e91..6f128d0a 100644 --- a/journal/_bootswatch.scss +++ b/journal/_bootswatch.scss @@ -4,10 +4,7 @@ $web-font-path: "https://fonts.googleapis.com/css?family=News+Cycle:400,700" !default; -@mixin web-font($path){ - @import url("#{$path}"); -} -@include web-font($web-font-path); +@import url($web-font-path); // Navbar ===================================================================== diff --git a/lumen/_bootswatch.scss b/lumen/_bootswatch.scss index face50d8..edb2e94e 100644 --- a/lumen/_bootswatch.scss +++ b/lumen/_bootswatch.scss @@ -4,10 +4,7 @@ $web-font-path: "https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,400italic" !default; -@mixin web-font($path){ - @import url("#{$path}"); -} -@include web-font($web-font-path); +@import url($web-font-path); @mixin shadow($width: 4px){ border-width: 0 1px $width 1px; diff --git a/paper/_bootswatch.scss b/paper/_bootswatch.scss index 054aa74f..878507bf 100644 --- a/paper/_bootswatch.scss +++ b/paper/_bootswatch.scss @@ -4,10 +4,7 @@ $web-font-path: "https://fonts.googleapis.com/css?family=Roboto:300,400,500,700" !default; -@mixin web-font($path){ - @import url("#{$path}"); -} -@include web-font($web-font-path); +@import url($web-font-path); // Navbar ===================================================================== diff --git a/readable/_bootswatch.scss b/readable/_bootswatch.scss index da63d8b1..65b8b617 100644 --- a/readable/_bootswatch.scss +++ b/readable/_bootswatch.scss @@ -4,10 +4,7 @@ $web-font-path: "https://fonts.googleapis.com/css?family=Raleway:400,700" !default; -@mixin web-font($path){ - @import url("#{$path}"); -} -@include web-font($web-font-path); +@import url($web-font-path); // Navbar ===================================================================== diff --git a/sandstone/_bootswatch.scss b/sandstone/_bootswatch.scss index b98b3f1b..ec0183d0 100644 --- a/sandstone/_bootswatch.scss +++ b/sandstone/_bootswatch.scss @@ -4,10 +4,7 @@ $web-font-path: "https://fonts.googleapis.com/css?family=Roboto:400,500" !default; -@mixin web-font($path){ - @import url("#{$path}"); -} -@include web-font($web-font-path); +@import url($web-font-path); // Navbar ===================================================================== diff --git a/simplex/_bootswatch.scss b/simplex/_bootswatch.scss index 7bc6e44a..8ba555d5 100644 --- a/simplex/_bootswatch.scss +++ b/simplex/_bootswatch.scss @@ -4,10 +4,7 @@ $web-font-path: "https://fonts.googleapis.com/css?family=Open+Sans:400,700" !default; -@mixin web-font($path){ - @import url("#{$path}"); -} -@include web-font($web-font-path); +@import url($web-font-path); @mixin btn-shadow($color){ @include gradient-vertical-three-colors(lighten($color, 3%), $color, 6%, darken($color, 3%)); diff --git a/spacelab/_bootswatch.scss b/spacelab/_bootswatch.scss index 804f1d6a..15fbb2d2 100644 --- a/spacelab/_bootswatch.scss +++ b/spacelab/_bootswatch.scss @@ -4,10 +4,7 @@ $web-font-path: "https://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700" !default; -@mixin web-font($path){ - @import url("#{$path}"); -} -@include web-font($web-font-path); +@import url($web-font-path); @mixin btn-shadow($color){ @include gradient-vertical-three-colors(lighten($color, 15%), $color, 50%, darken($color, 4%)); diff --git a/superhero/_bootswatch.scss b/superhero/_bootswatch.scss index 0833a30f..0f731129 100644 --- a/superhero/_bootswatch.scss +++ b/superhero/_bootswatch.scss @@ -4,10 +4,7 @@ $web-font-path: "https://fonts.googleapis.com/css?family=Lato:300,400,700" !default; -@mixin web-font($path){ - @import url("#{$path}"); -} -@include web-font($web-font-path); +@import url($web-font-path); // Navbar ===================================================================== diff --git a/united/_bootswatch.scss b/united/_bootswatch.scss index 3afb5170..4f5c668a 100644 --- a/united/_bootswatch.scss +++ b/united/_bootswatch.scss @@ -4,10 +4,7 @@ $web-font-path: "https://fonts.googleapis.com/css?family=Ubuntu:400,700" !default; -@mixin web-font($path){ - @import url("#{$path}"); -} -@include web-font($web-font-path); +@import url($web-font-path); // Navbar ===================================================================== diff --git a/yeti/_bootswatch.scss b/yeti/_bootswatch.scss index 8bc400f6..03d5fbca 100644 --- a/yeti/_bootswatch.scss +++ b/yeti/_bootswatch.scss @@ -4,10 +4,7 @@ $web-font-path: "https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,400,300,700" !default; -@mixin web-font($path){ - @import url("#{$path}"); -} -@include web-font($web-font-path); +@import url($web-font-path); // Navbar ===================================================================== -- cgit v1.2.3