2014-10-10 18:54:07 +04:00
|
|
|
// # 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
|
2017-04-04 19:07:35 +03:00
|
|
|
var proxy = require('./proxy'),
|
2017-04-10 12:30:21 +03:00
|
|
|
_ = require('lodash'),
|
2017-04-04 19:07:35 +03:00
|
|
|
getAssetUrl = proxy.metaData.getAssetUrl,
|
|
|
|
SafeString = proxy.SafeString;
|
2014-10-10 18:54:07 +04:00
|
|
|
|
2017-04-04 19:07:35 +03:00
|
|
|
module.exports = function asset(path, options) {
|
2017-04-10 12:30:21 +03:00
|
|
|
var hasMinFile = _.get(options, 'hash.hasMinFile');
|
2017-02-03 21:25:39 +03:00
|
|
|
|
2017-04-04 19:07:35 +03:00
|
|
|
return new SafeString(
|
2017-04-10 12:30:21 +03:00
|
|
|
getAssetUrl(path, hasMinFile)
|
2016-01-17 13:07:52 +03:00
|
|
|
);
|
2017-04-04 19:07:35 +03:00
|
|
|
};
|