Query the DOM in JavaScript with a familiar SQL syntax. Generates a CSS query selector that will in turn call the document.querySelectorAll().
A live playground is available to test out queries and see the generated CSS selectors.
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.
npm install jelly-sqlOR
yarn add jelly-sqlSee 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"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>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"
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
- Get things going: kbysiec/vite-vanilla-ts-lib
Source code is licensed under MIT