Skip to content

Commit

Permalink
Replace any fonts URL on build
Browse files Browse the repository at this point in the history
  • Loading branch information
Toilal committed Dec 14, 2015
1 parent 6af8166 commit 739d52b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
10 changes: 1 addition & 9 deletions generators/app/templates/gulp/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,7 @@ gulp.task('html', ['inject', 'partials'], function () {
.pipe(jsFilter.restore)
.pipe(cssFilter)
.pipe($.sourcemaps.init())
<% if (props.ui.key === 'bootstrap' && props.cssPreprocessor.extension === 'scss') { -%>
.pipe($.replace('../<%- computedPaths.appToBower %>/bower_components/bootstrap-sass/assets/fonts/bootstrap/', '../fonts/'))
<% } else if (props.ui.key === 'bootstrap' && props.cssPreprocessor.extension === 'less') { -%>
.pipe($.replace('../<%- computedPaths.appToBower %>/bower_components/bootstrap/fonts/', '../fonts/'))
<% } else if (props.ui.key === 'bootstrap' && props.cssPreprocessor.extension === 'styl') { -%>
.pipe($.replace('../<%- computedPaths.appToBower %>/bower_components/bootstrap-stylus/fonts/', '../fonts/'))
<% } else if (props.ui.key === 'material-design-lite' || props.ui.key === 'angular-material') { -%>
.pipe($.replace('../<%- computedPaths.appToBower %>/bower_components/material-design-iconfont/iconfont/', '../fonts/'))
<% } -%>
.pipe($.replace(/(?:\.\.\/)*bower_components\/.*\/(.*\.(?:eot|svg|ttf|woff|woff2))/, '../fonts/$1'))
.pipe($.minifyCss({ processImport: false }))
.pipe($.rev())
.pipe($.sourcemaps.write('maps'))
Expand Down
11 changes: 0 additions & 11 deletions test/template/test-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,11 @@ describe('gulp-angular build template', function () {
model.props.ui.key = 'noUI';
model.props.cssPreprocessor.extension = 'css';
var result = build(model);
result.should.not.match(/\$\.replace/);
result.should.match(/mainBowerFiles\(\)\)/);

model.props.ui.key = 'bootstrap';
model.props.cssPreprocessor.extension = 'scss';
result = build(model);
result.should.match(/\$\.replace\('\.\.\/appToBower\/bower_components\/bootstrap-sass/);

model.props.cssPreprocessor.extension = 'less';
result = build(model);
result.should.match(/\$\.replace\('\.\.\/appToBower\/bower_components\/bootstrap\//);

model.props.cssPreprocessor.extension = 'styl';
result = build(model);
result.should.match(/\$\.replace\('\.\.\/appToBower\/bower_components\/bootstrap-stylus\//);
result.should.match(/mainBowerFiles\(\).concat\('bower_components\/bootstrap-stylus\/fonts\/\*'\)/);
});

Expand All @@ -67,7 +57,6 @@ describe('gulp-angular build template', function () {
model.props.ui.key = 'material-design-lite';
var result = build(model);
result = build(model);
result.should.match(/\$\.replace\('\.\.\/appToBower\/bower_components\/material-design-iconfont\/iconfont\//);
result.should.match(/mainBowerFiles\(\).concat\('bower_components\/material-design-iconfont\/iconfont\/\*'\)/);
});

Expand Down

0 comments on commit 739d52b

Please sign in to comment.