Skip to content

Transition shorthand property throws error because of sourcemaps (3.7.1) #3299

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

Closed
mahish opened this issue Jul 31, 2018 · 9 comments
Closed
Labels

Comments

@mahish
Copy link

mahish commented Jul 31, 2018

Originally posted to gulp-less gulp-community/gulp-less#299. But the issue is with the LESS itself.

lessc 3.7.1 => Error with lessc --source-map=file.map styles.less styles.css:

SyntaxError: Cannot read property 'substring' of undefined in /Users/.../components/button.less on line 62, column 3:
61   cursor: pointer;
62   transition: background-color @duration-short @easing-out;
63   border-radius: @base-border-radius;

gulp-less 4.0.1 stacktrace of the error is telling more:

Potentially unhandled rejection [2] TypeError: Cannot read property 'substring' of undefined
    at SourceMapOutput.add (/Users/.../node_modules/less/lib/less/source-map-output.js:72:39)
    at Call.genCSS (/Users/.../node_modules/less/lib/less/tree/call.js:86:12)
    at Expression.genCSS (/Users/.../node_modules/less/lib/less/tree/expression.js:54:23)
    at Declaration.genCSS (/Users/.../node_modules/less/lib/less/tree/declaration.js:35:20)
    at Ruleset.genCSS (/Users/.../node_modules/less/lib/less/tree/ruleset.js:508:18)
    at Ruleset.genCSS (/Users/.../node_modules/less/lib/less/tree/ruleset.js:508:18)
    at SourceMapOutput.toCSS (/Users/.../node_modules/less/lib/less/source-map-output.js:123:24)
    at SourceMapBuilder.toCSS (/Users/.../node_modules/less/lib/less/source-map-builder.js:23:35)
    at ParseTree.toCSS (/Users/.../node_modules/less/lib/less/parse-tree.js:33:47)
    at /Users/.../node_modules/less/lib/less/render.js:35:40
    at /Users/.../node_modules/less/lib/less/parse.js:86:21
    at ImportVisitor.finish [as _finish] (/Users/.../node_modules/less/lib/less/parser/parser.js:240:28)
    at ImportVisitor._onSequencerEmpty (/Users/.../node_modules/less/lib/less/visitors/import-visitor.js:36:14)
    at ImportSequencer.tryRun (/Users/.../node_modules/less/lib/less/visitors/import-sequencer.js:50:14)
    at /Users/.../node_modules/less/lib/less/visitors/import-sequencer.js:19:25
    at fileParsedFunc (/Users/.../node_modules/less/lib/less/import-manager.js:63:17)
    at /Users/.../node_modules/less/lib/less/import-manager.js:137:25
    at finish (/Users/.../node_modules/less/lib/less/parser/parser.js:240:28)
    at Object.parse (/Users/.../node_modules/less/lib/less/parser/parser.js:248:24)
    at loadFileCallback (/Users/.../node_modules/less/lib/less/import-manager.js:136:68)
    at <anonymous>

It works fine without sourcemaps option.

@mahish mahish changed the title Transition shorthand property throws error (3.7.1) Transition shorthand property throws error because of sourcemaps (3.7.1) Jul 31, 2018
@matthew-dean
Copy link
Member

This looks related to #3300.

@mahish
Copy link
Author

mahish commented Aug 1, 2018

@matthew-dean Yeah. Looks like. So let me clarify my case.

I dont use CSS variables. Used LESS variables have the following values:

@duration-long: 0.62s;
@easing-out: cubic-bezier(0.2, 0.62, 0.38, 1);

There is no error, if I remove these variables from the transition shorthand property and use direct values instead.

@matthew-dean
Copy link
Member

@mahish Can you see if this branch fixes your issue? https://github.com/matthew-dean/less.js/tree/bugfix-3300

@mahish
Copy link
Author

mahish commented Aug 6, 2018

@matthew-dean I did npm install matthew-dean/less.js#bugfix-3300 -g, then lessc --source-map=file.map styles.less styles.css in the folder and didnt get any error.

@matthew-dean
Copy link
Member

@mahish Great! Thanks for letting me know!

@matthew-dean
Copy link
Member

@mahish Does it appear to still be mapping lines correctly? I have no reason to think otherwise, just making sure.

@mahish
Copy link
Author

mahish commented Aug 7, 2018

I couldnt make sourcemaps work in the project (I dont think it is related to this issue). So I created new one (small and simple) for testing purposes. And so I can say lines are mapped correctly:)

@matthew-dean
Copy link
Member

@mahish Great!

@matthew-dean
Copy link
Member

v3.8.1 released

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

No branches or pull requests

2 participants