Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

评论:使用 gulp 压缩 CSS #12

Closed
nimoc opened this issue Apr 6, 2015 · 5 comments
Closed

评论:使用 gulp 压缩 CSS #12

nimoc opened this issue Apr 6, 2015 · 5 comments
Labels

Comments

@nimoc
Copy link
Owner

nimoc commented Apr 6, 2015

请在此处留下你对 使用 gulp 压缩 CSS 的评论

@nimoc nimoc added the 评论 label Apr 6, 2015
@nimoc nimoc closed this as completed Oct 5, 2016
@xiaohp
Copy link

xiaohp commented Aug 21, 2017

你可以访问 gulp-minify-css 以查看更多用法。

这个链接打不开

@niupuyue
Copy link

现在的话gulp-minify-css是已经被舍弃掉了,现在都是gulp-clean-css,这个也挺好都用的。gulp-clean-css

@xiaohp
Copy link

xiaohp commented Aug 21, 2017

好的,感谢告知。

@shujiabi
Copy link

我跟着操作 但最后没有压缩成功 是复制了一个css文件夹出来

@postbird
Copy link

@shujiabi 你的task怎么写的?使用的是 gulp-clean-css ?

https://www.npmjs.com/package/gulp-clean-css

let gulp = require('gulp');
let cleanCSS = require('gulp-clean-css');
let sourcemaps = require('gulp-sourcemaps');
 
gulp.task('minify-css',() => {
  return gulp.src('./src/*.css')
    .pipe(sourcemaps.init())
    .pipe(cleanCSS())
    .pipe(sourcemaps.write())
    .pipe(gulp.dest('dist'));
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants