0.9.13 • Published 1 year ago
jelly-sql v0.9.13
About
Query the DOM in JavaScript with a familiar SQL syntax. Generates a CSS query selector that will in turn call the document.querySelectorAll().
Getting Started
Jelly SQL requires no third-party dependencies. You can use it in the browser or in Node.js. TypeScript is also supported.
Full documentation can be found at docs.jellysql.com.
Using npm or yarn
Install
npm install jelly-sqlOR
yarn add jelly-sqlImport & Use
See the API documentation for more information, and the cheat sheet for a quick reference.
import { query } from 'jelly-sql';
const selector = query(`SELECT * FROM DOM WHERE TAG = 'a'`);
console.log(selector); // Output: "a"Using a CDN (Browser)
You can also use Jelly SQL in the browser by including the following script tag:
<script src="https://cdn.jsdelivr.net/npm/jelly-sql@latest/build/dist/jelly-sql.min.js"></script>Usage
This will expose the jellySQL object globally, which you can use to query the DOM. See the API documentation for more information, and the cheat sheet for a quick reference.
const selector = jellySQL.query(`SELECT * FROM DOM WHERE TAG = 'a'`);
console.log(selector); // Output: "a"Local Development
npm run-script <keyword>
dev- starts dev serverbuild- generates the following bundles: ESM (.js) and IIFE (.iife.js). The name of bundle is automatically taken frompackage.jsonname propertytest- starts vitest and runs all teststest:watch- starts vitest and runs all tests, but watch for changes & rerun when changes detectedtest:coverage- starts vitest and run all tests with code coverage reportlint:scripts- lint.tsfiles with eslintlint:styles- lint.cssand.scssfiles with stylelintformat:scripts- format.ts,.htmland.jsonfiles with prettierformat:styles- format.csand.scssfiles with stylelintformat- format all with prettier and stylelintprepare- script for setting up husky pre-commit hookuninstall-husky- script for removing husky from repository
Acknowledgement
- Get things going: kbysiec/vite-vanilla-ts-lib
License
Source code is licensed under MIT