Query the DOM in JavaScript with a familiar SQL syntax. Generates a CSS query selector that will in turn call the document.querySelectorAll()
.
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-sql
OR
yarn add jelly-sql
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"
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.json
name 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.ts
files with eslintlint:styles
- lint.css
and.scss
files with stylelintformat:scripts
- format.ts
,.html
and.json
files with prettierformat:styles
- format.cs
and.scss
files 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