All Projects → helpers → Handlebars Helper Asset

helpers / Handlebars Helper Asset

Licence: mit
Handlebars helper for generating a relative path from the current file to the specified asset (CSS, JavaScript, image, icon etc.).

Programming Languages

javascript
184084 projects - #8 most used programming language

{{asset}} NPM version

Handlebars helper for generating a assetative link from the current page to the specified page.

Example

<link rel="stylesheet" href="{{asset 'css/styles.css'}}">

Results in something like:

<link href="../../assets/css/styles.css" rel="stylesheet">

Installation

Install with npm

npm i handlebars-helper-asset --save-dev

Install with bower

bower install handlebars-helper-asset --save-dev

Register the helper

The easiest way to register the helper with Assemble is to add the module to devDependencies and keywords in your project's package.json:

{
  "devDependencies": {
    "handlebars-helper-asset": "*"
  },
  "keywords": [
    "handlebars-helper-asset"
  ]
}

Alternatively, to register the helper explicitly in the Gruntfile:

grunt.initConfig({
  assemble: {
    options: {
      // the 'handlebars-helper-asset' npm module must also be listed in
      // devDependencies for assemble to automatically resolve the helper
      helpers: ['handlebars-helper-asset', 'foo/*.js']
    },
    files: {
      'dist/': ['src/templates/*.hbs']
    }
  }
});

Author

Jon Schlinkert

License and Copyright

Copyright (c) 2014 Jon Schlinkert, contributors. Licensed under the MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].