@aiursoft/autodark.js
Advanced tools
Comparing version 1.1.4 to 1.2.0
{ | ||
"name": "@aiursoft/autodark.js", | ||
"version": "1.1.4", | ||
"version": "1.2.0", | ||
"description": "Auto dark theme", | ||
@@ -11,3 +11,3 @@ "main": "dist/cjs/autodark.js", | ||
"build-css": "node-sass src/autodark.scss dist/css/autodark.min.css --output-style compressed --source-map true", | ||
"build-js": "tsc -b ./tsconfig.cjs.json ./tsconfig.esm.json ./tsconfig.types.json", | ||
"build-js": "tsc -b ./tsconfig.json ./tsconfig.types.json", | ||
"build": "npm run build-css && npm run build-js", | ||
@@ -14,0 +14,0 @@ "format": "prettier --write .", |
@@ -17,46 +17,22 @@ # AutoDark.js | ||
### Import (as ESM) | ||
## Reference CSS | ||
```js | ||
import { autoTheme } from '@aiursoft/autodark.js' | ||
autoTheme() | ||
``` | ||
ECMAScript modules (ESM) can be directly imported in a browser: | ||
```html | ||
<script type="module"> | ||
import { autoTheme } from '@aiursoft/autodark.js' | ||
autoTheme() | ||
</script> | ||
``` | ||
### Import (as CommonJS) | ||
```js | ||
const { autoTheme } = require('@aiursoft/autodark.js') | ||
autoTheme() | ||
``` | ||
### Reference CSS | ||
You also need to reference the CSS file in your HTML: | ||
```html | ||
<link | ||
rel="stylesheet" | ||
href="./node_modules/@aiursoft/autodark.js/dist/css/autodark.min.css" | ||
/> | ||
<link rel="stylesheet" href="./node_modules/bootstrap/dist/css/bootstrap.min.css" /> | ||
<link rel="stylesheet" href="./node_modules/@aiursoft/autodark.js/dist/css/autodark.min.css" /> | ||
``` | ||
You don't need to reference bootstrap's CSS file. The auto dark library is based on bootstrap's CSS file. | ||
## Reference JavaScript | ||
But you need to reference bootstrap's JavaScript file: | ||
You also need to reference bootstrap's JavaScript file: | ||
```html | ||
<script src="./node_modules/jquery/dist/jquery.min.js" defer></script> | ||
<script | ||
src="./node_modules/bootstrap/dist/js/bootstrap.bundle.min.js" | ||
defer | ||
></script> | ||
<script src="./node_modules/bootstrap/dist/js/bootstrap.bundle.min.js" defer></script> | ||
<script type="module"> | ||
import { autoTheme } from './node_modules/@aiursoft/autodark.js/dist/esm/autodark.js' | ||
autoTheme() | ||
</script> | ||
``` | ||
@@ -63,0 +39,0 @@ |
@@ -8,5 +8,7 @@ { | ||
"strict": true, | ||
"target": "ESNext" | ||
"target": "ESNext", | ||
"outDir": "./dist/esm", | ||
"module": "esnext" | ||
}, | ||
"include": ["src/**/*"] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
23830
14
482
53