Skip to content

Instantly share code, notes, and snippets.

@johno
Last active August 29, 2015 14:16
Show Gist options
  • Save johno/338a39c14f75a0da4301 to your computer and use it in GitHub Desktop.
Save johno/338a39c14f75a0da4301 to your computer and use it in GitHub Desktop.
Proposed immutable.css functionality/API.
.u-i-will-be-opened-twice {
color: yellow;
}
.u-actually-immutable-selector {
content: 'I am not being reopened';
}
.awesome {
font-variant: small-caps; /* Raises linting error (opened vendor.css selector) */
}
.u-i-will-be-opened-twice {
background-color: red; /* Raises linting error (re-opened a util selector) */
}
immutableCss.lint('vendor.css', 'app.css', { immutablePrefixes: ['.u-'] })
.awesome {
color: green;
}
@jxnblk
Copy link

jxnblk commented Mar 11, 2015

So if I understand correctly, immutablePrefixes would just scope the selectors that it's checking against with a prefix?

To me, altering any style from another file is bad practice. Also thinking about how this would work with Bootstrap.

@johno
Copy link
Author

johno commented Mar 11, 2015

I was thinking that immutablePrefixes would be in addition to ensuring style altering isn't occurring between files. I will update this gist to make it a bit more clear.

@johno
Copy link
Author

johno commented Mar 11, 2015

Okay, so now .awesome doesn't have a .u- prefix but would still raise an error. I'm thinking that there are particular prefixes, in addition to ensuring vendor CSS (bootstrap/basscss/etc), that we want to make sure aren't reopened.

@johno
Copy link
Author

johno commented Mar 11, 2015

Scaffolded out a project and added you as a collaborator, @jxnblk. If you want to move it under your name on Github let me know, I'm happy to transfer it over to you.

https://github.com/johnotander/immutable.css

@jxnblk
Copy link

jxnblk commented Mar 11, 2015

Okay, I think this makes more sense now...

You're too fast, i'll move convo over to your repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment