posthtml-px2rem icon indicating copy to clipboard operation
posthtml-px2rem copied to clipboard

Look at posthtml-postcss + postcss plugins :)

Open voischev opened this issue 9 years ago • 3 comments

https://github.com/posthtml/posthtml-postcss https://github.com/cuth/postcss-pxtorem

voischev avatar Dec 28 '15 20:12 voischev

We are using https://github.com/cuth/postcss-pxtorem in our gulp workflow now, so I made this posthtml-px2rem for HTML output use.

hzlzh avatar Dec 29 '15 07:12 hzlzh

gulp.task('html', function() {
    var posthtml = require('gulp-posthtml');
    return gulp.src('src/**/*.html')
        .pipe(posthtml([ require('posthtml-postcss')([
            require('postcss-pxtorem')
            /* other postcss plugins */
        ]/*, postcssOptionsObj */) ]))
        .pipe(gulp.dest('build/'));
});

should make equal result for HTML

voischev avatar Dec 29 '15 08:12 voischev

posthtml-px2rem has some issues rather than postcss-pxtorem, for example, media query option. So if there are some css styles in html (not inline-style), it seems better to use posthtml-postcss+postcss-pxtorem instead. If there are only inline-styles in HTML, posthtml-px2rem can handle.

chenkun24 avatar Jul 31 '16 09:07 chenkun24