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

CssSyntaxError error in less file #16

Open
rab1 opened this issue Jan 29, 2019 · 6 comments
Open

CssSyntaxError error in less file #16

rab1 opened this issue Jan 29, 2019 · 6 comments

Comments

@rab1
Copy link

rab1 commented Jan 29, 2019

While running checklanguagekeys getting error in valid less comment syntax

button {
    &:focus {
        //To avoid weird outline for buttons with border radius
        outline: none; 
    }
}

This issue was not there in "assetgraph-builder": "4.12.2", error stack is

CssSyntaxError: file:///home/rab/shop/http-pub/shop/less/theme.less:165:28: Unknown word
    at Input.error (/home/rab/shop/node_modules/assetgraph/node_modules/postcss/lib/input.js:130:16)
    at Parser.unknownWord (/home/rab/shop/node_modules/assetgraph/node_modules/postcss/lib/parser.js:563:22)
    at Parser.other (/home/rab/shop/node_modules/assetgraph/node_modules/postcss/lib/parser.js:168:12)
    at Parser.parse (/home/rab/shop/node_modules/assetgraph/node_modules/postcss/lib/parser.js:77:16)
    at Function.parse (/home/rab/shop/node_modules/assetgraph/node_modules/postcss/lib/parse.js:17:12)
    at Css.get parseTree [as parseTree] (/home/rab/shop/node_modules/assetgraph/lib/assets/Css.js:117:35)
    at Css.eachRuleInParseTree (/home/rab/shop/node_modules/assetgraph/lib/assets/Css.js:374:34)
    at Css.findOutgoingRelationsInParseTree (/home/rab/shop/node_modules/assetgraph/lib/assets/Css.js:239:10)
    at Css.get outgoingRelations [as outgoingRelations] (/home/rab/shop/node_modules/assetgraph/lib/assets/Asset.js:1075:38)
    at Css.populate (/home/rab/shop/node_modules/assetgraph/lib/assets/Asset.js:1312:12)
    at Css.load (/home/rab/shop/node_modules/assetgraph/lib/assets/Asset.js:515:14)
    at <anonymous>
@rab1
Copy link
Author

rab1 commented Jan 29, 2019

I think it's a similar issue like postcss/postcss#1102

How to add syntax option as postcss-less into checklanguagekeys ?

@papandreou
Copy link
Member

AssetGraph doesn't transpile anything (so injecting postcss-less isn't really an option).

theme.less shouldn't be parsed as CSS when it has a .less extension, so it's a bit weird.

How is theme.less being referenced? Via an @import(...) or a <link rel=stylesheet href=...>?

@rab1
Copy link
Author

rab1 commented Jan 29, 2019

It included via link

<link rel="stylesheet" type="text/css" href="/shop/less/theme.less">

@papandreou
Copy link
Member

Right, then assetgraph is inferring that the target asset is CSS because of the fact that it has a <link rel=stylesheet href=...> pointing at it, which is not really unreasonable.

What sees to it that this file gets transpiled in your dev setup (server middleware?) and in your production build (assetgraph-builder < 5?)

Which version of assetgraph-builder are you using?

@rab1
Copy link
Author

rab1 commented Jan 30, 2019

We are using [email protected]

@papandreou
Copy link
Member

Good! What about the other questions?

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

No branches or pull requests

2 participants