Skip to content

Utility function to build individual HTML tags from CSS selectors.

Notifications You must be signed in to change notification settings

dskrepps-legacy/selector2tag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

selector2tag

Utility function to build individual HTML tags from CSS selectors. Uses Slick's parser for most of the hard work. I should rework it to build multiple tags.

Example

	var sel2tag = require('selector2tag');
	var wrap = sel2tag('main#content.wrapper.foo[role="main"][bar]');
	
	var result = wrap.openingTag + 'Hello World' + wrap.closingTag;

Result:

<main id="content" class="wrapper foo" role="main" bar>Hello World</main>

The tag name defaults to div.

About

Utility function to build individual HTML tags from CSS selectors.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published