본문 바로가기
gulp

사스로 벤더프리픽스

by uni:D 2016. 9. 26.
  // config.sass.src = 'theme/assets/src/scss/**/*.{scss,sass}'
  // config.sass.dest = 'theme/assets/css/"
  gulp.task('styles', ['clean:styles'], function () {

    // Prevent reading sourcemaps to autoprefix them or make sourcemaps of sourcemaps
    var filter = gulpFilter(['*.css', '!*.map']);

    return gulp.src(config.sass.src)
      .pipe(plumber())
      .pipe(sourcemaps.init())
      .pipe(sass({ errLogToConsole: true }))
      .pipe(sourcemaps.write('./'))
      .pipe(filter)
      .pipe(autoprefixer({ browsers: ['last 2 versions' ], cascade: true }))
      .pipe(filter.restore())
      .pipe(gulp.dest(config.sass.dest));
  });

참고url

https://github.com/sindresorhus/gulp-autoprefixer/issues/8



https://www.npmjs.com/package/autoprefixer




======================

번역url :

https://webgoto.net/316/ 

위의 페이지에서 필요한 부분만 가져옴




1. 

gulp-autoprefixer 를 깔고 나서

node_modules>gulp-autoprefixer>node_modules>autoprefixer>node_modules>browserslist>index.js 를 복사해서

show.js 파일로 이름을 만들어줍니다.





show. js 파일을 열어서 맨밑에 


console.log(browserslist("last 2 versions"));


을 넣어줍니다.


그리고 해당 autoprefixer 가 깔려진 경로를 찾아서 

제파일의 경로 입니다 해당 파일을 경로대로 커맨드창에 아래와 같이 쳐줍니다.


node E:\__newProject\scss_test\node_modules\gulp-autoprefixer\node_modules\autoprefixer\node_modules\browserslist\show.js



last 2 versions

라고 적어주면 저렇게 사용하는 브라우져가 나오는데

css3가 보통 ie9부터 적용되기때문에 저는 3으로 설정해줍니다.


console.log(browserslist("last 3 versions"));


ie8까지하고싶으면 아래와 같이 설정해주면 됩니다.

console.log(browserslist("last 3 versions,ie >= 8,iOS >= 6,Android >= 3"));


사용 브라우져별 적용방법 : 

https://github.com/ai/browserslist#user-content-browserslist-





'gulp' 카테고리의 다른 글

spritesmith hover  (0) 2017.02.17
gulp-html-tag-include  (0) 2016.12.05
gulp.spritesmith 스프라이트이미지  (0) 2016.09.28