segmentio / myth

A CSS preprocessor that acts like a polyfill for future versions of the spec.
4.32k stars 131 forks source link

SyntaxError: 'undefined' is not an object (evaluating 'declarations.forEach') #48

Closed stevenvachon closed 10 years ago

stevenvachon commented 10 years ago
var less = {
    relativeUrls: false,
    rootpath: appRoot,
    postProcessor: function(styles){ console.log(styles); return myth(styles) }
};

Logging out styles gives me accurate CSS, and simply doing return styles works fine. Am I missing something somewhere?

Here is the full error:

SyntaxError: 'undefined' is not an object (evaluating 'declarations.forEach')
in init.less 
http://localhost:8000/vendors/myth/myth.js:10181:11
forEach@[native code]
http://localhost:8000/vendors/myth/myth.js:10180:29
forEach@[native code]
visit@http://localhost:8000/vendors/myth/myth.js:10171:21
vars@http://localhost:8000/vendors/myth/myth.js:10054:10
use@http://localhost:8000/vendors/myth/myth.js:10879:5
plugin@http://localhost:8000/vendors/myth/myth.js:41:9
use@http://localhost:8000/vendors/myth/myth.js:10879:5
myth@http://localhost:8000/vendors/myth/myth.js:28:9
postProcessor@http://localhost:8000/:27:49
postProcessCSS@http://localhost:8000/vendors/less.js/dist/less-1.7.0.js:7401:41
http://localhost:8000/vendors/less.js/dist/less-1.7.0.js:7895:36
http://localhost:8000/vendors/less.js/dist/less-1.7.0.js:7796:29
finish@http://localhost:8000/vendors/less.js/dist/less-1.7.0.js:696:36
run@http://localhost:8000/vendors/less.js/dist/less-1.7.0.js:6284:29
parse@http://localhost:8000/vendors/less.js/dist/less-1.7.0.js:702:25
http://localhost:8000/vendors/less.js/dist/less-1.7.0.js:7793:40
http://localhost:8000/vendors/less.js/dist/less-1.7.0.js:7751:21
handleResponse@http://localhost:8000/vendors/less.js/dist/less-1.7.0.js:7676:21
doXHR@http://localhost:8000/vendors/less.js/dist/less-1.7.0.js:7696:23
loadFile@http://localhost:8000/vendors/less.js/dist/less-1.7.0.js:7745:10
loadStyleSheet@http://localhost:8000/vendors/less.js/dist/less-1.7.0.js:7769:13
loadStyleSheets@http://localhost:8000/vendors/less.js/dist/less-1.7.0.js:7809:23
refresh@http://localhost:8000/vendors/less.js/dist/less-1.7.0.js:7886:20
http://localhost:8000/vendors/less.js/dist/less-1.7.0.js:7912:13
global code@http://localhost:8000/vendors/less.js/dist/less-1.7.0.js:7921:3
ianstormtaylor commented 10 years ago

hmm, hard to tell. i'd be curious to know what console.log(myth(styles)) returns

stevenvachon commented 10 years ago

It doesn't log anything because of the error.

ianstormtaylor commented 10 years ago

hopefully fixed in 1.0.0, let me know if not

stevenvachon commented 10 years ago

Still not working.

stevenvachon commented 10 years ago

The comment in this block is what throws the error:

@keyframes section-intro-children
{
    0%   { opacity:0 }
    25%  { opacity:0 }  /* simulates a delay */
    100% { opacity:1 }
}

With the comment removed, it parses without error.

MoOx commented 10 years ago

It's not the same issue at all. Reported here https://github.com/reworkcss/rework-vars/issues/32

MoOx commented 10 years ago

Fixed here https://github.com/reworkcss/rework-vars/pull/33 Hopefully released soon (as a rework-vars update, so you will just need to delete & reinstall myth, or run npm update myth (not sure if this last one works, I never understand what npm update does ^^))

stevenvachon commented 10 years ago

Thanks!

MoOx commented 10 years ago

The issue came from the rework-visit helper, I'll try to fix than asap.