2014-10-10 09:54:07 -05:00
|
|
|
// # Asset helper
|
2019-03-25 23:36:41 -05:00
|
|
|
// Usage: `{{asset "css/screen.css"}}`
|
2014-10-10 09:54:07 -05:00
|
|
|
//
|
2019-03-25 23:36:41 -05:00
|
|
|
// Returns the path to the specified asset.
|
|
|
|
const proxy = require('./proxy');
|
|
|
|
const get = require('lodash/get');
|
|
|
|
const {SafeString} = proxy;
|
|
|
|
const {getAssetUrl} = proxy.metaData;
|
2014-10-10 09:54:07 -05:00
|
|
|
|
2017-04-04 11:07:35 -05:00
|
|
|
module.exports = function asset(path, options) {
|
2018-06-04 11:30:21 -05:00
|
|
|
const hasMinFile = get(options, 'hash.hasMinFile');
|
2017-02-03 13:25:39 -05:00
|
|
|
|
2017-04-04 11:07:35 -05:00
|
|
|
return new SafeString(
|
2017-04-10 04:30:21 -05:00
|
|
|
getAssetUrl(path, hasMinFile)
|
2016-01-17 05:07:52 -05:00
|
|
|
);
|
2017-04-04 11:07:35 -05:00
|
|
|
};
|