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

[TypeError: Cannot read property 'split' of undefined] #268

Closed
plauge opened this issue Mar 9, 2016 · 4 comments
Closed

[TypeError: Cannot read property 'split' of undefined] #268

plauge opened this issue Mar 9, 2016 · 4 comments

Comments

@plauge
Copy link

plauge commented Mar 9, 2016

HI,
I've just started using PostCSS - so maybe Im the bug :-)

I'm getting this error in my terminal. If I remove lost() from the pipe(), I do not get any errors.
Only thing I found that looks as the same "bug" is this #160 - but it did not help me.

Anybody knwo how to fix this?

Thanks!!

[11:55:40] { [TypeError: Cannot read property 'split' of undefined]
  name: 'TypeError',
  message: 'Cannot read property \'split\' of undefined',
  stack: 'TypeError: Cannot read property \'split\' of undefined\n    
at appendToSelectors (/Applications/MAMP/htdocs/wwwroot/myWebsite/wp-content/themes/pixelhuset16/node_modules/lost/lib/new-block.js:7:13)\n    
at newBlock (/Applications/MAMP/htdocs/wwwroot/myWebsite/wp-content/themes/pixelhuset16/node_modules/lost/lib/new-block.js:14:22)\n    
at /Applications/MAMP/htdocs/wwwroot/myWebsite/wp-content/themes/pixelhuset16/node_modules/lost/lib/lost-column.js:137:11\n    
at /Applications/MAMP/htdocs/wwwroot/myWebsite/wp-content/themes/pixelhuset16/node_modules/postcss/lib/container.js:98:28\n    
at /Applications/MAMP/htdocs/wwwroot/myWebsite/wp-content/themes/pixelhuset16/node_modules/postcss/lib/container.js:73:26\n    
at AtRule.each (/Applications/MAMP/htdocs/wwwroot/myWebsite/wp-content/themes/pixelhuset16/node_modules/postcss/lib/container.js:60:22)\n    
at AtRule.walk (/Applications/MAMP/htdocs/wwwroot/myWebsite/wp-content/themes/pixelhuset16/node_modules/postcss/lib/container.js:72:21)\n    
at /Applications/MAMP/htdocs/wwwroot/myWebsite/wp-content/themes/pixelhuset16/node_modules/postcss/lib/container.js:75:32\n    
at Rule.each (/Applications/MAMP/htdocs/wwwroot/myWebsite/wp-content/themes/pixelhuset16/node_modules/postcss/lib/container.js:60:22)\n    
at Rule.walk (/Applications/MAMP/htdocs/wwwroot/myWebsite/wp-content/themes/pixelhuset16/node_modules/postcss/lib/container.js:72:21)',

Here is how my dependencies looks in my package.json fil:

  "devDependencies": {
    "autoprefixer": "^6.3.3",
    "cssnano": "^3.5.2",
    "cssnext": "^1.8.4",
    "gulp": "^3.9.1",
    "gulp-cssnano": "^2.1.1",
    "gulp-postcss": "^6.1.0",
    "gulp-sourcemaps": "^1.6.0",
    "gulp-util": "^3.0.7",
    "gulp-webserver": "^0.9.1",
    "lost": "^6.7.2",
    "postcss-color-function": "^2.0.0",
    "postcss-inline-comment": "^2.0.0",
    "precss": "^1.3.0"
  },

And here is my gulp file:

var gulp = require('gulp'),
gutil = require('gulp-util'),
webserver = require('gulp-webserver'),
postcss = require('gulp-postcss'),
sourcemaps = require('gulp-sourcemaps'),
postCSS_InlineComment = require('postcss-inline-comment');
autoprefixer = require('autoprefixer'),
precss = require('precss'),
cssnano = require('cssnano'),
cssnext = require('cssnext'),
lost = require('lost'),
colorfunctions = require('postcss-color-function'),    

source = 'dev/css/',
dest = 'front/';



gulp.task('css', function() {
  gulp.src(source + 'style.css')
  .pipe(sourcemaps.init())
  .pipe(postcss([
    autoprefixer(),
    colorfunctions(),
    precss(),
    lost(),    
    postCSS_InlineComment(),
    cssnano(),
    cssnext()
    ]))
  .on('error', gutil.log)
  .pipe(sourcemaps.write('./'))
  .pipe(gulp.dest(dest + 'css'));
});

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

gulp.task('webserver', function() {
  gulp.src(dest)
  .pipe(webserver({
    livereload: true,
    open: true
  }));
});

gulp.task('default', ['css','watch']); 
@plauge
Copy link
Author

plauge commented Mar 9, 2016

I've tried to put lost() in the beginning and in the end of the pipe(). Same result.

@peterramsing peterramsing changed the title [TypeError: Cannot read property 'split' of undefined] [TypeError: Cannot read property 'split' of undefined] Mar 9, 2016
@peterramsing
Copy link
Owner

Just out of curiosity, what if you put autoprefixer() after lost()?

@peterramsing peterramsing self-assigned this Mar 9, 2016
@plauge
Copy link
Author

plauge commented Mar 9, 2016

Sorry - Im new to PostCSS.
After some more test, I can see that some of my SASS code not was converted correct.

BTW - very nice library! Im coming from the Susy grid.

@peterramsing
Copy link
Owner

@plauge Super. Glad you got it sorted and thanks!

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

No branches or pull requests

2 participants