Gaspard
Lightweight DOM helpers without dependency
The goal is to implement each You might not need jQuery’s functions as ES modules. Enabling the power of Tree-shaking in webpack or rollup.
Getting started
Installing
npm | yarn | bower | jsDelivr |
---|---|---|---|
npm install gaspard | yarn add gaspard | bower install gaspard | gaspard.umd.js |
The Vue.js plugin Vue-gaspard is also available!
Usage
Include gaspard on your project
// Via ES2015 import statement
import * as Gaspard from 'gaspard'
// or via Commonjs
const Gaspard = require('gaspard')
And import methods (listed in the API Documentation)
import { documentReady, find, css, addClass, fadeIn } from 'gaspard'
documentReady(() => {
addClass(document.documentElement, 'dom-loaded')
const app = find('#app')
css(app, 'background-color', 'green')
const paragraph = find('p:first-child', app)[0]
addClass(paragraph, 'introduction')
fadeIn(paragraph)
})
Or use gaspard within a <script>
<script src="https://cdn.jsdelivr.net/npm/gaspard@latest/dist/gaspard.umd.js"></script>
<script>
Gaspard.documentReady(function () {
Gaspard.addClass(document.documentElement, 'dom-loaded');
});
</script>
API documentation
Contribute
- Fork the repository
- Clone it locally and install dependencies with npm (or yarn)
npm install
- Create a new branch
- Develop your feature/fix with tests running
npm run test:watch
- Commit, Push your branch and make a pull request on gaspard repository
Thanks
Thanks to the open source community of You might not need jQuery, jQuery, and cash
Licensing
MIT License Copyright (c) 2017 Luca Perret