Have ideas to improve npm?Join in the discussion! »

    handlebars-imgix

    1.0.0 • Public • Published

    handlebars-imgix

    nodei.co

    npm

    github-issues

    stars

    forks

    handlebars / imgix helper to generate imgix urls.

    install

    npm i --save handlebars-imgix

    usage

    import { handlebarsImgix } from 'handlebars-imgix'
    import { handlebars } from 'handlebars'
    Handlebars.registerHelper('imgix', handlebarsImgix('mycloud'))
     
    handlebars.compile('<img src="{{imgix images/cat.jpg "{ width:400, height:300, crop:\'fill\' }"}}" alt="image alt">').template({})
    // <img src="http://res.imgix.com/mycloud/image/upload/c_fill,h_300,w_400/v1/imgix_id" alt="image alt">

    quotes

    The example above shows a problem you run into if trying to declare strings in js. The escaped quotes will work fine in this case.

    In a handlebars template file, you can just use single quotes.

    compatibility

    dist/index.js should be fully compatible with node 6

    Author

    Levi Wheatcroft levi@wht.cr

    Contributing

    Contributions welcome; Please submit all pull requests against the master branch.

    License

    MIT

    Install

    npm i handlebars-imgix

    DownloadsWeekly Downloads

    1

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • avatar