Open keshin opened 8 years ago
Hey @keshin, currently, the external URL will remain external. You probably don't want the @import
either, correct? Ideally, I think the @import
would be removed and the referenced resource would just be treated as another dependency that goes through the Lasso.js asset pipeline. It's possible to make those changes without breaking existing functionality.
@keshin Unfortunately, doing a dynamic replace from a CSS file isn't going to be possible unless you use a css-preprocessor, like SASS or LESS, that have the variables defined. Additionally, you would need to use the controlled source and not resolve to a compiled bower asset.
Another solution for fonts is to load them in a asynchronous fashion using lasso-loader and have all imports removed, as @patrick-steele-idem mentioned.
On some of our projects we use WebFont Loader.
Here is a quick example:
async.js:
require('lasso-loader').async(function(err){
WebFontConfig = {
google: {
families: ['Roboto:300,400,500,700']
}
};
(function(d) {
var wf = d.createElement('script'), s = d.scripts[0];
wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1.6.16/webfont.js';
s.parentNode.insertBefore(wf, s);
})(document);
});
browser.json:
{
"dependencies": [
"require-run: ./async.js",
"./your-css-file.css"
]
}
Hope this helps a bit more.
Hi Here are my case, I have a css resolved from bower, which have an import for some external resource like below:
What I want is manage the fonts resource in first line. I can add it in
browser.json
withexternal:false
, while I'm not sure if lasso will be the url replacement in the css file above?