Skip to content
This repository has been archived by the owner on May 5, 2020. It is now read-only.
/ preact-script2 Public archive

Preact component for insert <script> tag, inspired by vue-script2

License

Notifications You must be signed in to change notification settings

mazipan/preact-script2

Repository files navigation

preact-script2

Preact component for insert <script> tag, inspired by vue-script2

version minified downloads Travis

Download

# NPM
npm install preact-script2

# Yarn
yarn add preact-script2

Usage

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 bundle

Credit


Copyright © 2019 by Irfan Maulana

About

Preact component for insert <script> tag, inspired by vue-script2

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published