Gulp 狼吞虎咽+;引导字体
简单地说,我有以下文件结构:Gulp 狼吞虎咽+;引导字体,gulp,gulp-sass,Gulp,Gulp Sass,简单地说,我有以下文件结构: frontend ├── bower_components │ └── bootstrap │ └── dist │ ├── css │ │ └── bootstrap.css │ └── fonts │ └── glyphicons-halflings-regular.eot │ ├── src │ ├── style │ │ └── main.
frontend
├── bower_components
│ └── bootstrap
│ └── dist
│ ├── css
│ │ └── bootstrap.css
│ └── fonts
│ └── glyphicons-halflings-regular.eot
│
├── src
│ ├── style
│ │ └── main.sass
│ └── index.html
│
└── gulpfile.js
build
├── css
│ └── main.css
├── fonts
| └── glyphicons-halflings-regular.eot
└── index.html
在main.sass
I中直接导入引导文件:
@import ../../bower_components/bootstrap/dist/css/bootstrap.css
但它会自动将链接更改为字体
。/font/glyph图标半身人常规。eot
到
。/../bower\u components/bootstrap/dist/font/glyphicons halflings regular.eot
我想在用Gulp建造之后得到的是这个结构:
frontend
├── bower_components
│ └── bootstrap
│ └── dist
│ ├── css
│ │ └── bootstrap.css
│ └── fonts
│ └── glyphicons-halflings-regular.eot
│
├── src
│ ├── style
│ │ └── main.sass
│ └── index.html
│
└── gulpfile.js
build
├── css
│ └── main.css
├── fonts
| └── glyphicons-halflings-regular.eot
└── index.html
我应该如何正确地构建所有内容以获得
main.css
到glyph.eot
的链接?最后,我放弃了.css文件的导入而选择了gulp concat。很好。Sourcemapping也是正确的
gulp.task('style:build', function () {
var cssStream = gulp.src(path.bower.bootstrap.css);
var sassStream = gulp.src(path.src.style)
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(prefixer())
.pipe(cleanCSS())
.pipe(sourcemaps.write());
var mergedStream = merge(cssStream, sassStream)
.pipe(sourcemaps.init())
.pipe(concat('main.css'))
.pipe(sourcemaps.write())
.pipe(gulp.dest(path.build.css))
.pipe(reload({stream: true}));
return mergedStream;
});