Code Monkey home page Code Monkey logo

dna.js's Introduction

dna.js

logo

An uncomplicated user interface library for building data-driven semantic templates

License:MIT npm Quality Vulnerabilities Hits Build

dna.js is a lightweight easy-to-use UI library enabling developers to rapidly build maintainable JavaScript applications.

1. Bookstore Example

Designate templates with the dna-template class, and put the templates directly into the HTML of your web page.  Use the element's id to indicate the name of the template.  Enclose data fields in double tildes ~~.

a) HTML for book template

<h1>Featured Books</h1>
<div id=book class=dna-template>
   <h2>~~title~~</h2>
   Author: <cite>~~author~~</cite>
</div>

Then call the dna.clone() function to insert a copy of the template into the DOM.  The supplied JSON data object populates the fields of the template.

b) JavaScript call to add book node

dna.clone('book', { title: 'The DOM', author: 'Jan' });

The new clone element replaces the template.  The original template is detached from the DOM and kept for additional cloning.

c) Resulting HTML with clone

<h1>Featured Books</h1>
<div class=book>
   <h2>The DOM</h2>
   Author: <cite>Jan</cite>
</div>

Need to clone the template multiple times?  Simply pass an array of data objects into the dna.clone() function.

2. Additional Information

3. Contributor Notes

To be a contributor, fork the project and run the commands npm install and npm test on your local clone.  Make your edits and rerun the tests.  Pull requests welcome.

Pull requests (PRs) should not update the version number in package.json or any files in the dist folder.  The version number and dist files are all updated as part of the release process.

Issues labeled "good first issue" make it easy for first time contributors to participate.  Only submit a PR for one of these issues if you're new to this project.



Feel free to submit questions at:
github.com/dnajs/dna.js/issues

dna.js is open source under the MIT License.  The website and documentation are published under the CC BY-SA 4.0 license.

dna.js's People

Contributors

dpilafian avatar calvinsettachatgul avatar nikmijic avatar oozygrub avatar paulord avatar dmwesterhoff avatar mcglaser avatar tpduong avatar thisisjeron avatar jlangdesign avatar aalpar avatar adzo261 avatar selva-oscura avatar likannp avatar hcamdclk8 avatar bykiandra avatar milroc avatar mmoorebrg avatar mtchllng avatar mindheist avatar prakal avatar teddytesafa avatar tcco avatar timgluz avatar dependabot[bot] avatar feargalobo avatar giteshk11 avatar huyl avatar sushiogoto avatar wanderfound1 avatar

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.