Git Product home page Git Product logo

Comments (5)

threepointone avatar threepointone commented on June 14, 2024

jade was simple; they have an &attributes(object) operator that spreads the object onto the element's attributes.
screen shot 2016-07-24 at 1 50 49 am

from glamor.

shrayasr avatar shrayasr commented on June 14, 2024

Angular JS comes with ng-attr-* and ng-class. So usage is something like

<div class="text-center" ng-class="{'text-danger': someBoolValue}">Foobar</div>

which would apply the text-danger class if someBoolValue is true

Reference: https://docs.angularjs.org/guide/interpolation


ps: Hope this is what you were looking for. I'm slightly new to frontend stuff, so might be wrong

from glamor.

treshugart avatar treshugart commented on June 14, 2024

I think for libraries and frameworks that don't use a virtual dom, then there will always be an integration step to sync the changes.

For libraries that don't use JSX, but do use a virtual DOM you can possibly just use Object.assign().

For example, Skate uses Incremental DOM and JSX is optional. So you can either:

<div {...style({}) } someattr="test" />

Or:

skate.vdom.element('div', Object.assign({}, style({}), { someattr: 'test' }));

from glamor.

threepointone avatar threepointone commented on June 14, 2024

couldn't figure out ember or angular templates. closing this issue, I think the main ones are covered.

from glamor.

threepointone avatar threepointone commented on June 14, 2024

fyi - ember/angular templates can use classname support now, so this is simpler

from glamor.

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.