cssdream / cssgrace

从今天起,写简单优雅面向未来的 CSS。From now on,writing brief,elegant,future-oriented CSS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot read property \'replace\' of undefined\n at ieInlineBlockHack

CopyJosh opened this issue · comments

I am getting this error when running cssgrace, on the PostCSS 5.0.21

[19:44:21] { [TypeError: Cannot read property 'replace' of undefined] name: 'TypeError', message: 'Cannot read property \'replace\' of undefined', stack: 'TypeError: Cannot read property \'replace\' of undefined\n at ieInlineBlockHack (/home/vagrant/Sites/pagekit/node_modules/cssgrace/lib/index.js:323:36)\n at /home/vagrant/Sites/pagekit/node_modules/cssgrace/lib/index.js:470:5\n at /home/vagrant/Sites/pagekit/node_modules/postcss/lib/container.js:94:28\n at /home/vagrant/Sites/pagekit/node_modules/postcss/lib/container.js:81:26\n at Rule.each (/home/vagrant/Sites/pagekit/node_modules/postcss/lib/container.js:68:22)\n at Rule.walk (/home/vagrant/Sites/pagekit/node_modules/postcss/lib/container.js:80:21)\n at Rule.walkDecls (/home/vagrant/Sites/pagekit/node_modules/postcss/lib/container.js:92:25)\n at cssgraceRule (/home/vagrant/Sites/pagekit/node_modules/cssgrace/lib/index.js:468:8)\n at /home/vagrant/Sites/pagekit/node_modules/postcss/lib/container.js:118:28\n at /home/vagrant/Sites/pagekit/node_modules/postcss/lib/container.js:81:26', fileName: '/home/vagrant/Sites/pagekit/packages/standardtextile/theme-stc/process/css/theme.css', showStack: true, showProperties: true, plugin: 'gulp-postcss' }

The error appears to be with this line:

https://github.com/cssdream/cssgrace/blob/master/lib/index.js#L323

Which is throwing an error when decl.raws.before is "undefined"...

However, undefined is a permitted state for that variable. It should be checked if the variable is undefined.

@CopyJosh maybe same with #45

Try my branch npm i gucong3000/cssgrace