gulp-hotcopy v0.7.3
Dynamic copy for your Gulp-generated HTML.
- Documentation: TK / not completed yet
- Issues: https://github.com/DallasMorningNews/gulp-hotcopy/issues/
- Testing: TK
- Coverage: TK
Features
- Descriptions TK.
Installation
This library is very specific to projects built with the latest versions of the generator-dmninteractives tool. As such, the instructions may not be particularly clear to external users.
If you're already using our generator tool, you can add hot copy in four easy steps:
- Run the following line (or add
gulp-hotcopyto your project's dependencies/devDependencies):
npm install gulp-hotcopyAdd an ArchieML file (with a
.amlextension) to./src/assets/hotcopy/.Add the line
"hotCopyDocument": "true"to yourmeta.json.Connect the hot copy to your template using the following code:
{% set hotCopy = hotCopyHelper() %}
{% set copy = hotCopy.connect('my_file') %}NOTE: The my_file value should have the same name as the .aml file you created earlier. You can connect several .aml files to an individual HTML page — just repeat the second line above, changing both the value passed to hotCopy.connect() and the variable this output is assigned to on each successive call.
- Test the integration by loading a value from the ArchieML file.
A variable called headline at the top level of the ArchieML file should now be accessible as {{ copy.headline }}.
You can also use the following formatters to render pieces of content in standard DMN styles:
{% include "hot-copy/_author-formatter.html" %}: Renders the first<p>tag in our byline block, using anauthorsvariable at the top level of the ArchieML file. (This formatter expects theauthorsvariable to be a list of author objects, each of which must containnameandemailfields.){% for bodyGraph in copy.body %}{% include "hot-copy/_graph-formatter.html" %}{% endfor %}: Renders each item listed in the top-levelbodyvariable, according to defined styles. Items in this list without a specific type will be rendered by the./src/templates/hot-copy/text-graph.html(plain paragraph) template. Other types will be rendered by their corresponding.htmlfile in./src/templates/embeds/.
Credits
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
9 years ago
9 years ago
9 years ago