Coder Social home page Coder Social logo

Custom rule block. about css HOT 6 CLOSED

reworkcss avatar reworkcss commented on June 12, 2024
Custom rule block.

from css.

Comments (6)

conradz avatar conradz commented on June 12, 2024

No, it basically only parses valid CSS code (mixin(a1, a2) is not a valid selector in CSS). You can see rework-plugin-mixin which does mixins that are specified in JS and used by using normal CSS properties.

The $var: value case could be easily implemented by relaxing the requirements for the property name. @necolas @jonathanong do you think we should do this?

EDIT: mixin(a1, a2) { } does parse correctly with mixin(a1, a2) as a selector string.

from css.

necolas avatar necolas commented on June 12, 2024

blah(a, b) just gets parsed as a selector; you can write a plugin to do something with it.

since this isn't a validating parser we could probably relax the property name parsing though.

from css.

 avatar commented on June 12, 2024

But what about this
For example:

$color: #fff;

.selector {
  color: $color;
}

Can I do something for parse this rule? Is it possible?

from css.

necolas avatar necolas commented on June 12, 2024

That's an invalid CSS syntax, so no. We have 2 working variables plugins you can use though:

https://github.com/reworkcss/rework-vars
https://github.com/reworkcss/rework-variables

from css.

ai avatar ai commented on June 12, 2024

If you just need to parse this syntax, you can use gonzales-pe. Also there is xcss postprocessor, which can works with custom syntax.

from css.

 avatar commented on June 12, 2024

@ai, thx. Mb, I'll try to create one another)

from css.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.