Gulp 定位@导入文件失败 nib.style
Gulp failed to locate@import file nib.style
我收到以下错误
failed to locate@import file nib.style
尝试使用 gulp
通过 .styl 文件编译时
知道如何解决吗?
gulp.task('flat', function () {
gulp.src(['**/*.styl', '!**/**mixins**.styl', '!**/**variables**.styl'])
.pipe(stylus())
.pipe(gulp.dest('test/'));
});
{
"dependencies": {
"bower": "~1.4.1",
"gulp": "~3.9.0",
"gulp-complexity": "~0.3.0",
"gulp-connect": "~2.2.0",
"gulp-jscs": "~2.0.0",
"gulp-jscs-stylish": "~1.1.2",
"gulp-jshint": "~1.11.2",
"gulp-sloc": "~1.0.4",
"gulp-util": "~3.0.6",
"gulp-stylus": "~2.1.1",
"jshint-stylish": "~2.0.1",
"open": "~0.0.5",
"stylus": "~0.52.4",
"nib": "~1.1.0"
},
"name": "app",
"private": true,
"version": "0.0.0"
}
我能够解决我的问题,包括 gulp 文件中的 nib,如 this article 中所述。
var stylus = require('gulp-stylus');
var nib = require('nib');
gulp.task('flat', function () {
gulp.src(['themes/**/*.styl', '!themes/**/**mixins**.styl', '!themes/**/**variables**.styl'])
.pipe(stylus({
compress: true,
use: nib()
}))
.pipe(gulp.dest('test/'));
});
您需要告诉 gulp-stylus
使用 nib
:
var nib = require('nib')();
...
.pipe(stylus({ use : nib }))
...
您必须在您的任务中导入 nib:
var nib = require( 'nib' );
而且你还需要告诉手写笔使用它:
gulp.src( [ '**/*.styl', '!**/**mixins**.styl', '!**/**variables**.styl' ] )
.pipe( stylus( { use: [ nib() ] } ) )
.pipe( gulp.dest( 'test/' ) );
});
我收到以下错误
failed to locate@import file nib.style
尝试使用 gulp
知道如何解决吗?
gulp.task('flat', function () {
gulp.src(['**/*.styl', '!**/**mixins**.styl', '!**/**variables**.styl'])
.pipe(stylus())
.pipe(gulp.dest('test/'));
});
{
"dependencies": {
"bower": "~1.4.1",
"gulp": "~3.9.0",
"gulp-complexity": "~0.3.0",
"gulp-connect": "~2.2.0",
"gulp-jscs": "~2.0.0",
"gulp-jscs-stylish": "~1.1.2",
"gulp-jshint": "~1.11.2",
"gulp-sloc": "~1.0.4",
"gulp-util": "~3.0.6",
"gulp-stylus": "~2.1.1",
"jshint-stylish": "~2.0.1",
"open": "~0.0.5",
"stylus": "~0.52.4",
"nib": "~1.1.0"
},
"name": "app",
"private": true,
"version": "0.0.0"
}
我能够解决我的问题,包括 gulp 文件中的 nib,如 this article 中所述。
var stylus = require('gulp-stylus');
var nib = require('nib');
gulp.task('flat', function () {
gulp.src(['themes/**/*.styl', '!themes/**/**mixins**.styl', '!themes/**/**variables**.styl'])
.pipe(stylus({
compress: true,
use: nib()
}))
.pipe(gulp.dest('test/'));
});
您需要告诉 gulp-stylus
使用 nib
:
var nib = require('nib')();
...
.pipe(stylus({ use : nib }))
...
您必须在您的任务中导入 nib:
var nib = require( 'nib' );
而且你还需要告诉手写笔使用它:
gulp.src( [ '**/*.styl', '!**/**mixins**.styl', '!**/**variables**.styl' ] )
.pipe( stylus( { use: [ nib() ] } ) )
.pipe( gulp.dest( 'test/' ) );
});