preact-script2
v1.0.0
Published
Library for insert <script> tag for Preact, inspired by vue-script2
Maintainers
Readme
preact-script2
Library for insert <script> tag for Preact, inspired by vue-script2
Download
# NPM
npm install preact-script2
# Yarn
yarn add preact-script2Usage
import Script2 from 'preact-script2';
export default class App extends Component {
render() {
return (
<div>
<Script2 src="/test.js" async type="some-type" integrity="1234567890" text="QWERTYUIOP" crossorigin="anonymous" />
<Script2
inlineScript="(function a() {console.warn('Hey, you just loading an inline script')})()" />
</div>
);
}
}Available Props
| Props Name | Type | Note |
| :------------------: | :---------------------------: | :--------------------------: |
| src | String | - |
| async | String | - |
| type | String | - |
| integrity | String | - |
| text | String | - |
| crossorigin | String | - |
| inlineScript | String | - |
Development
# NPM
# Running development
npm run dev
# Build demo apps
npm run build
# Build library for publish
npm run bundle
# Yarn
# Running development
yarn dev
# Build demo apps
yarn build
# Build library for publish
yarn bundleCredit
Copyright © 2019 by Irfan Maulana
