Comments (12)
The last time I saw these types of errors, it was on v2. I'm really at a loss as to what could be causing errors on your end that don't appear on mine. I suggested the screen share so I could show that I wasn't making it up haha.
So I've managed to reproduce this, kind of. Something about parsing the font values on line 3 first, causes the 1/-1
value to fail. If I put any other parse in front of that, it works fine. So it's something about that value that's throwing things out of whack. I'll have to look into it further to see whats up. This is going to be a tough one to track down.
from postcss-values-parser.
Here's the culprit:
That little 'g'
from postcss-values-parser.
Fixed in b6bcc5a. Thanks for working through this one with me.
from postcss-values-parser.
If you're looking for more exotic font stuff, this is what I use to test projectwallace/css-analyzer: https://github.com/projectwallace/css-analyzer/blob/7dc6a0d7e093f408d5fd2e7db7da405fd5b2043d/test/analyzer/values/input.css#L145-L172
from postcss-values-parser.
Thanks for the issue. This is a weird one as it's not throwing an error for me - when I run that reproduction, I get a root node with the following in root.nodes
:
[ Word {
raws: { before: '', after: '' },
value: 'normal',
type: 'word',
isColor: false,
isHex: false,
isVariable: false,
parent:
Root {
raws: [Object],
type: 'root',
nodes: [Circular],
source: [Object] },
source: { start: [Object], input: [Input], end: [Object] } },
Word {
raws: { before: ' ', after: '' },
value: 'normal',
type: 'word',
isColor: false,
isHex: false,
isVariable: false,
parent:
Root {
raws: [Object],
type: 'root',
nodes: [Circular],
source: [Object] },
source: { start: [Object], input: [Input], end: [Object] } },
Numeric {
raws: { before: ' ', after: '' },
value: '1',
type: 'numeric',
unit: 'em',
parent:
Root {
raws: [Object],
type: 'root',
nodes: [Circular],
source: [Object] },
source: { start: [Object], input: [Input], end: [Object] } },
Operator {
raws: { before: '', after: '' },
value: '/',
type: 'operator',
parent:
Root {
raws: [Object],
type: 'root',
nodes: [Circular],
source: [Object] },
source: { start: [Object], input: [Input], end: [Object] } },
Numeric {
raws: { before: '', after: '' },
value: '1',
type: 'numeric',
unit: '',
parent:
Root {
raws: [Object],
type: 'root',
nodes: [Circular],
source: [Object] },
source: { start: [Object], input: [Input], end: [Object] } },
Quoted {
raws: { before: ' ', after: '' },
value: '\'Source Sans Pro\'',
type: 'quoted',
quote: '\'',
parent:
Root {
raws: [Object],
type: 'root',
nodes: [Circular],
source: [Object] },
source: { start: [Object], input: [Input], end: [Object] } },
Punctuation {
raws: { before: '', after: '' },
value: ',',
type: 'punctuation',
parent:
Root {
raws: [Object],
type: 'root',
nodes: [Circular],
source: [Object] },
source: { start: [Object], input: [Input], end: [Object] } },
Word {
raws: { before: ' ', after: '' },
value: 'serif',
type: 'word',
isColor: false,
isHex: false,
isVariable: false,
parent:
Root {
raws: [Object],
type: 'root',
nodes: [Circular],
source: [Object] },
source: { start: [Object], input: [Input], end: [Object] } } ]
Any chance you have a sticky 2.x version lingering about?
from postcss-values-parser.
Ah, found a better way to reproduce:
parse(`normal normal 1em/1 'Source Sans Pro', serif`).walk(node => {
console.log(node)
})
// throw this.input.error('Unknown word', tokens[0][2], tokens[0][3]);
Perhaps I shouldn't be using the .walk
method anymore?
from postcss-values-parser.
I also found that it throws errors on the following values:
grid-columns: 1/-1
font: 1em/ 1 serif
It does not throw when I add spacing around the /
, so I'm starting to suspect that spacing around /
could be at play here.
from postcss-values-parser.
OK something is going on in your environment. I've tried every example/repro you've posted here and every single one of them is working for me in a fresh environment. Would it help if I put up a small repo with them all to show them working?
I still suspect you have an old version of postcss-values-parser being loaded.
from postcss-values-parser.
I cooked up a tiny repo for testing purposes: https://github.com/bartveneman/postcss-values-parser-v3.0.0-beta.2-testcase
from postcss-values-parser.
Thanks for doing that. I went through all of the test cases in index.js and all of them worked for me. The only difference between my setup and yours is I'm on Node 10.13.0. Could you have an old version of postcss-values-parser installed globally that is somehow taking precedence?
If you'd like to, we could setup a Google Hangout and do a screen share to try and figure this out.
from postcss-values-parser.
I checked, but there is no global/other version for postcss-values-parser than the one in my package.json and package-lock.json. Is this error specific for v2?
from postcss-values-parser.
Amazing, glad you were able to find it. Up to v3.0.0! 😁
from postcss-values-parser.
Related Issues (20)
- Exception thrown on float angle values HOT 4
- Options for initial line/column values HOT 1
- Sass forward prefixes parsing as a word and operator instead of just a word HOT 8
- postcss-values-parser hangs indefinitely HOT 5
- License Change: from MPL-2.0 to MIT to be aligned with postcss pkgs HOT 1
- Can't parse `++(1)` HOT 2
- URL parameters are being parsed into functional groups, when they should be ignored. HOT 2
- Replace url-regex and is-url-superb with custom implementation HOT 6
- Can't parse font property font-size/line-height syntax HOT 7
- cannot parse grid values 1/-1 HOT 5
- Postcss 8 support HOT 1
- Depends on package `url-regex` with high severity vulnerability HOT 3
- No comment in property value HOT 2
- Cannot parse proprietary IE functions HOT 3
- css clamp() syntax error HOT 4
- Cannot parse calculations without spaces around the * operator HOT 5
- Cannot parse `url()` with unquoted data url HOT 1
- Unable to clone value with quotes characters
- Multiple versions of this library can't coexist HOT 2
- v7 Information HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from postcss-values-parser.