Skip to content

Commit 739d52b

Browse files
committed
Replace any fonts URL on build
1 parent 6af8166 commit 739d52b

File tree

2 files changed

+1
-20
lines changed

2 files changed

+1
-20
lines changed

generators/app/templates/gulp/_build.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,7 @@ gulp.task('html', ['inject', 'partials'], function () {
5555
.pipe(jsFilter.restore)
5656
.pipe(cssFilter)
5757
.pipe($.sourcemaps.init())
58-
<% if (props.ui.key === 'bootstrap' && props.cssPreprocessor.extension === 'scss') { -%>
59-
.pipe($.replace('../<%- computedPaths.appToBower %>/bower_components/bootstrap-sass/assets/fonts/bootstrap/', '../fonts/'))
60-
<% } else if (props.ui.key === 'bootstrap' && props.cssPreprocessor.extension === 'less') { -%>
61-
.pipe($.replace('../<%- computedPaths.appToBower %>/bower_components/bootstrap/fonts/', '../fonts/'))
62-
<% } else if (props.ui.key === 'bootstrap' && props.cssPreprocessor.extension === 'styl') { -%>
63-
.pipe($.replace('../<%- computedPaths.appToBower %>/bower_components/bootstrap-stylus/fonts/', '../fonts/'))
64-
<% } else if (props.ui.key === 'material-design-lite' || props.ui.key === 'angular-material') { -%>
65-
.pipe($.replace('../<%- computedPaths.appToBower %>/bower_components/material-design-iconfont/iconfont/', '../fonts/'))
66-
<% } -%>
58+
.pipe($.replace(/(?:\.\.\/)*bower_components\/.*\/(.*\.(?:eot|svg|ttf|woff|woff2))/, '../fonts/$1'))
6759
.pipe($.minifyCss({ processImport: false }))
6860
.pipe($.rev())
6961
.pipe($.sourcemaps.write('maps'))

test/template/test-build.js

-11
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,11 @@ describe('gulp-angular build template', function () {
4444
model.props.ui.key = 'noUI';
4545
model.props.cssPreprocessor.extension = 'css';
4646
var result = build(model);
47-
result.should.not.match(/\$\.replace/);
4847
result.should.match(/mainBowerFiles\(\)\)/);
4948

5049
model.props.ui.key = 'bootstrap';
51-
model.props.cssPreprocessor.extension = 'scss';
52-
result = build(model);
53-
result.should.match(/\$\.replace\('\.\.\/appToBower\/bower_components\/bootstrap-sass/);
54-
55-
model.props.cssPreprocessor.extension = 'less';
56-
result = build(model);
57-
result.should.match(/\$\.replace\('\.\.\/appToBower\/bower_components\/bootstrap\//);
58-
5950
model.props.cssPreprocessor.extension = 'styl';
6051
result = build(model);
61-
result.should.match(/\$\.replace\('\.\.\/appToBower\/bower_components\/bootstrap-stylus\//);
6252
result.should.match(/mainBowerFiles\(\).concat\('bower_components\/bootstrap-stylus\/fonts\/\*'\)/);
6353
});
6454

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

0 commit comments

Comments
 (0)