Ghost/core/server/helpers/asset.js
kirrg001 9b704f1691 Fixed single lodash import
no issue

- the dot notation only works if you install a single lodash dependency e.g. `yarn install lodash.get`
- otherwise we have to use `lodash/get`
2018-06-04 22:44:41 +02:00

17 lines
535 B
JavaScript

// # Asset helper
// Usage: `{{asset "css/screen.css"}}`, `{{asset "css/screen.css" ghost="true"}}`
//
// Returns the path to the specified asset. The ghost flag outputs the asset path for the Ghost admin
const proxy = require('./proxy'),
get = require('lodash/get'),
getAssetUrl = proxy.metaData.getAssetUrl,
SafeString = proxy.SafeString;
module.exports = function asset(path, options) {
const hasMinFile = get(options, 'hash.hasMinFile');
return new SafeString(
getAssetUrl(path, hasMinFile)
);
};