Gulp AMP HTML tag importer
A Gulp plugin for automating the import of required custom-element
<script/>
tags in AMPHTML files.
Installation
Install package with NPM and add it to your development dependencies:
npm install --save-dev amphtml-import-tags
Usage
-
Add placeholder to your source files:
${ampjs}Hello, amphtml-import-tags!<!-- ..... --> -
Incorporate the package in your gulpfile:
const importTags = ;gulp; -
Generated AMP HTML now includes any required
custom-element
<script/>
tags:Hello, amphtml-import-tags!<!-- ..... -->
Using custom placeholder
By default source files should use the placeholder ${ampjs}
to mark where <script/>
tags should be inserted.
To specify a different placeholder, pass an argument to .create()
, for example:
// Expects to find "[AMP-JS]" in source files.const importTags = ; // ...
Release Notes
1.1.0
- Added detection for more non-standard import scenarios.
1.0.2
- Documentation bug fix.
1.0.1
- Version bump for release to npmjs.
1.0.0
- initial release