From dabebf9df65db148e1157ff9f7bf90ec6d35b490 Mon Sep 17 00:00:00 2001 From: Luca Perret Date: Mon, 11 Dec 2017 20:05:22 +0100 Subject: [PATCH] docs(README): Adding methods example --- README.md | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 3acf28c..1b25dc7 100644 --- a/README.md +++ b/README.md @@ -36,25 +36,19 @@ import * as Gaspard from 'gaspard' const Gaspard = require('gaspard') ``` -:fire: Use gaspard's [Collection](https://github.com/lucaperret/gaspard/blob/master/docs/API.md#srccollectionjs) to queries elements and perform actions on each :fire: -```javascript -import { Collection } from 'gaspard' -const collection = new Collection('div.highlight') -collection - .css('background-color', 'green') - .find('p:first-child') // returns a new gaspard collection - .addClass('introduction') - .fadeIn(400) - .elements // Array of matched elements - .forEach(element => { - console.log('div.highlight first paragraph', element) - }) -``` And import methods (listed in the [API Documentation](#API)) ```javascript -import { documentReady } from 'gaspard' +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) }) ```