0.4.0 • Published 7 years ago

amp-generator v0.4.0

Weekly downloads
3
License
ISC
Repository
github
Last release
7 years ago

Generate AMP's

When you have to make AMP templates regularly you can use this module. It generates HTML pages from a src/pages directory (important you put everything in a src dir!)

// package.json
{
    ...
    "scripts": {
        "dev": "generate-amp -s ./src/pages -o ./build",
        "build": "generate-amp -s ./src/pages -o ./dist -p"
    },
    ...
}

available options

'--help' - explanation '-s' - source directory for pages (must be in a subdir, not in your project root) '-o' - output folder '-v' - more verbose

Directory structure

src/
    pages/
        index/
            data.js
            style.styl
            template.tpl
    components/
        layout.tpl
        navigation.tpl
    styles/
        variables.styl

Data file (plain js)

module.exports = {
    name: 'page-name',
    ...props // Everything you declare here will be available in you template
}

.tpl file (nunjucks)

{% extends '../../components/layout.tpl' %}

{% block content %}
    Write something!
{% endblock%}

.styl file (stylus)

$color-primary = #ffffff

.main
    display: flex