Git Product home page Git Product logo

Comments (9)

nrn avatar nrn commented on August 27, 2024

Yeah, the important thing to me is the createElement function. I'll use it with hyperx when i'm working with something kinda like a template partial, or with https://www.npmjs.com/package/instyled when I want a reusable component with built in styling and simple behavior (once I get around to PRing the ability to change the createElement function), or even directly when i'm building DOM from a complex data structure. Sometimes I won't use it if I just have a static html string.

Then I'll dump the results of the above into probably a thin wrapper around morphdom (for now, unless something similar comes up that fits my needs better).

from nanohtml.

max-mapper avatar max-mapper commented on August 27, 2024

@shama yea I like the morphom composition in your example. Do you think you can also do the same with the dom-css/hyperx moduless, or would that make it significantly less convenient to use?

from nanohtml.

shama avatar shama commented on August 27, 2024

The easiest way for dom-css is to just remove it and we would do:

var bel = require('bel')
var css = require('dom-css')
var div = bel`<div>hello</div>`
css(div, {color: 'red'})

Which is only slightly less convenient. I'm not a huge fan of inline styles anyways so this feature isn't super important to me. I prefer to write CSS in a template string and setting an unique class on my modules 👉 https://github.com/shama/bel/wiki/CSS-Modules


As for hyperx, it would become:

var hyperx = require('hyperx')
var bel = hyperx(require('bel'))
var div = bel`<div>hello</div>`

Which isn't too bad and would mean we could use hyperxify until or instead of #7.

At that point, this library becomes an alternative to hyperscript. So maybe a better strategy is to work on parity and just use hyperscript?

from nanohtml.

shama avatar shama commented on August 27, 2024

Or maybe not... looking at the source of hyperscript, it's doing a bit more things.

from nanohtml.

max-mapper avatar max-mapper commented on August 27, 2024

I'm curious what some of the examples in the bel readme/wiki would look like in this "composable style". On the one hand it'd be nice to have composability to avoid frameworkiness, on the other it might be too many things to compose at once (making it less convenient).

from nanohtml.

shama avatar shama commented on August 27, 2024

I'll convert some of the elements I've got in progress now and see how much of a pain it is.

from nanohtml.

shama avatar shama commented on August 27, 2024

Done. Please use https://github.com/maxogden/yo-yo for a more full feature set.

from nanohtml.

jorgebucaran avatar jorgebucaran commented on August 27, 2024

@shama I was wondering if there was any chance you could bring back dom-css or provide a way for users to specify their own.

from nanohtml.

shama avatar shama commented on August 27, 2024

@jbucaran You can still use dom-css as it works with any native element:

var el = bel`<button>push me</button>`
domCSS(el, { border: '1px solid #000' })

from nanohtml.

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.