Preact component for insert <script> tag, inspired by vue-script2
# NPM
npm install preact-script2
# Yarn
yarn add preact-script2
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>
);
}
}
Props Name | Type | Note |
---|---|---|
src |
String | - |
async |
String | - |
type |
String | - |
integrity |
String | - |
text |
String | - |
crossorigin |
String | - |
inlineScript |
String | - |
# 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 bundle
Copyright © 2019 by Irfan Maulana