grunt-csso icon indicating copy to clipboard operation
grunt-csso copied to clipboard

Fatal error: Identifier is expected (958)

Open andrewfleming opened this issue 8 years ago • 13 comments

Package version: 2.2.0

Affected node versions: 8.1.4

My grunt-csso task fails with the error Fatal error: Identifier is expected (958).

package.json gruntfile.js

grunt-csso and grunt-cli are installed locally.

I've taken these steps in my project.

rm -rf node_modules npm i -D grunt-cli npm i -D grunt-csso npm i for the other packages grunt

Running "csso:build" (csso) task
Fatal error: Identifier is expected  (958)

andrewfleming avatar Jul 13 '17 03:07 andrewfleming

Looks like a problem with either your css, or your gruntfile.

Can you run other tasks ?

Can you also run grunt --stack and give me the stack trace ?

Thanks!

nitriques avatar Jul 13 '17 15:07 nitriques

Other tasks run successfully, and the error appears when the csso task starts. Excluding csso task results in all tasks completing successfully.

The --stack flag does not help in this instance as I get the same fatal error.

grunt --stack
Running "clean:build" (clean) task
>> 4 paths cleaned.

Running "copy:main" (copy) task
Copied 85 files

Running "sass:build" (sass) task

Running "postcss:dist" (postcss) task
>> 2 processed stylesheets created.
>> 2 sourcemaps created.

Running "concat:build" (concat) task

Running "imagemin:build" (imagemin) task
Minified 14 images (saved 4.83 kB)

Running "csso:build" (csso) task
Fatal error: Identifier is expected  (965)

I simplified my CSSO grunt task as much as possible, but it continues to fail with the same fatal error

csso: {
	build: {
		files: {
			'build/css/style.min.css': 'build/css/style.css'
		}
	}
}

Thanks for your help :)

andrewfleming avatar Jul 14 '17 03:07 andrewfleming

I am sad to say this, but it looks like you css is invalid. https://github.com/csstree/csstree/blob/1a750f9f52a0397dc64fae07d7a358fad30d46be/lib/syntax/node/AttributeSelector.js#L37

That error message is at multiple places in the css parser https://github.com/csstree/csstree/search?p=1&q=%27Identifier+is+expected%27&type=&utf8=%E2%9C%93

I think we need to update the dependencies...

nitriques avatar Jul 14 '17 19:07 nitriques

Thanks for the reply @nitriques . I'll try and locate CSS which is not being parsed.

andrewfleming avatar Jul 20 '17 06:07 andrewfleming

No problem. I'll keep this issue open to remind me of updating the deps. Wanna share the 'build/css/style.min.css' file ?

nitriques avatar Jul 24 '17 18:07 nitriques

@andrewfleming do you still have issues with this ?

nitriques avatar Oct 30 '17 21:10 nitriques

Yes, I'm still seeing this issue.

A build/css/style.min.css file is not generated, so I'm not able to supply.

andrewfleming avatar Oct 30 '17 23:10 andrewfleming

Can you share the source, i.e. build/css/style.css ?

nitriques avatar Oct 31 '17 01:10 nitriques

Attached is the package.json, gemfile, gruntfile and sass files which should allow you to replicate the issue. csso-issue-31.zip

andrewfleming avatar Oct 31 '17 01:10 andrewfleming

Can you just share the build/css/style.css file? I do not have ruby nor sass on my machine.

nitriques avatar Nov 07 '17 01:11 nitriques

Here's a link to a gist with the CSS output https://gist.github.com/andrewfleming/e2fd3134c0d2cef3a9a765a7e34e4963

andrewfleming avatar Nov 14 '17 01:11 andrewfleming

There are a couple of problems...

  1. https://gist.github.com/andrewfleming/e2fd3134c0d2cef3a9a765a7e34e4963#file-csso-debugging-L1079 (missing a 'd')
  2. https://gist.github.com/andrewfleming/e2fd3134c0d2cef3a9a765a7e34e4963#file-csso-debugging-L1188 keyframes animations can't be defined in a media query
  3. https://gist.github.com/andrewfleming/e2fd3134c0d2cef3a9a765a7e34e4963#file-csso-debugging-L1266 mixin call problems ?

I would suggest to make sure it's valid using https://jigsaw.w3.org/css-validator/validator

nitriques avatar Nov 14 '17 01:11 nitriques

Here is where the error comes from : https://github.com/csstree/csstree/search?utf8=%E2%9C%93&q=RightParenthesis&type=

nitriques avatar Nov 14 '17 01:11 nitriques