Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support !default and !global as !important #78

Open
alexander-akait opened this issue Feb 6, 2018 · 3 comments
Open

Support !default and !global as !important #78

alexander-akait opened this issue Feb 6, 2018 · 3 comments

Comments

@alexander-akait
Copy link

alexander-akait commented Feb 6, 2018

Example

$var: /* comment 1 */ all /* comment 2 */ !import /* comment 3 */ ; /* comment 4 */

Parse as

Declaration {
      raws: 
       { before: '',
         between: ': /* comment 1 */ ',
         important: ' !important /* comment 3 */ ',
         value: { value: 'all ', raw: 'all /* comment 2 */' } },
      type: 'css-decl',
      source: 
       { start: { line: 1, column: 1 },
         input: 
          Input {
            css: '$var: /* comment 1 */ all /* comment 2 */ !important /* comment 3 */ ; /* comment 4 */\n',
            id: '<input css 1>' },
         end: { line: 1, column: 70 } },
      prop: '$var',
      important: true,
      value: 'all ' }

It should be easy for implement, if you accept i will do PR.

Use case - for prettier, don't eat comment and don't parse inside package. Thanks!

@ai
Copy link
Member

ai commented Feb 6, 2018

We can set Declaration#raws.scssGlobal and scssDefault if property name is started with $.

I think it will be better to not remove !global from value (in this case CSS stringifier will stringify it back).

PR is welcome :).

@alexander-akait
Copy link
Author

alexander-akait commented Feb 6, 2018

@ai we add !global when have flag scssGlobal, maybe we can add value have with global and add scssValue without !global ?

@ai
Copy link
Member

ai commented Feb 6, 2018

Yeap, raws.scssValue is good idea.

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

No branches or pull requests

2 participants