sylvainpolletvillard / postcss-grid-kiss

A PostCSS plugin to keep CSS grids stupidly simple
https://sylvainpolletvillard.github.io/grid-kiss-playground/index.html
MIT License
1.32k stars 53 forks source link

Using the node.js v4 can not run postcss-grid-kiss #7

Closed airen closed 7 years ago

airen commented 7 years ago

@sylvainpolletvillard

This plugin is very good. I tried to use today, found a small problem.The use of simple to describe my situation.

node.js version

v4.7.2

gulpfile.js config

var gulp = require('gulp');
var postcss = require('gulp-postcss');
var cssnext = require('postcss-cssnext');
var gridkiss = require('postcss-grid-kiss');

var browserOptions = {
  browsers: [
  'last 3 versions',
  'ie >= 10',
  'ie_mob >= 10',
  'ff >= 30',
  'chrome >= 34',
  'safari >= 6',
  'opera >= 12.1',
  'ios >= 6',
  'android >= 4.4',
  'bb >= 10',
  ]
};

gulp.task('css', function(){
    var processors = [
        cssnext(browserOptions),
        gridkiss({fallback: true})
    ];

    return gulp.src('./src/*.css')
        .pipe(postcss(processors))
        .pipe(gulp.dest('./dest'));
});

gulp.task('html', function (){
    return gulp.src('./src/*.html')
        .pipe(gulp.dest('./dest'));
});

gulp.task('watch', function (){
    gulp.watch('./src/*.html', ['html']);
    gulp.watch('./src/*.css', ['css']);
});

gulp.task('default', ['watch']);

run gulp in terminal, There will be an error message:

/Applications/XAMPP/xamppfiles/htdocs/workshop/postGrid/node_modules/postcss-grid-kiss/src/main.js:3
const {parse}             = require("./parse");
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Applications/XAMPP/xamppfiles/htdocs/workshop/postGrid/node_modules/postcss-grid-kiss/index.js:3:12)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)

Then I have updated the version of the node.js (v6.9.4). post-grid-kiss can run normally.

I want to say is that there are a lot of people use node 4. So many people can't use this plugin.Would you consider to repair this problem.

sylvainpolletvillard commented 7 years ago

Ah, you are the first one asking for Node <6 support. I wanted to see if this is still needed, apparently it is. No problem, I will add an ES5 version supporting older Node versions in the next version. Shouldn't take long

sylvainpolletvillard commented 7 years ago

Here we go, tests passing on nodejs v4.3 : https://travis-ci.org/sylvainpolletvillard/postcss-grid-kiss