How use contentFor in engines
See original GitHub issueSo, I have a engine with lazyLoading: false
inside a fresh ember app. My engine have addons and one of them have the code below:
# index.js
/* eslint-env node */
'use strict';
module.exports = {
name: 'ember-cli-neutral',
contentFor(type, config) {
if (type === 'head') {
if (config.googleFonts) {
let families = config.googleFonts.join('|');
return '<link href="https://fonts.googleapis.com/css?family=' + families + '" rel="stylesheet">'; // eslint-disable-line
}
}
}
};
# environment.js
/* eslint-env node */
'use strict';
module.exports = () => {
const ENV = {
googleFonts: [
'Roboto:400,500'
]
};
return ENV;
};
If I run engine separately the link of google fonts works perfectly, but if I run inside the fresh ember app not.
Perhaps a feature for future or it’s outside the scope of this project?
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
25 tips to optimize your content for people and search engines
Content optimization today should combine a user-first approach with a good grounding in SEO. Here's how to get the right balance.
Read more >How to Optimize your Content For Users and Search Engines
In this video, you'll learn what is SEO content and the exact process to follow to optimize your content for search engines and...
Read more >Should We Write Content for People or Search Engines?
Should you write content for people? Or shoud you write SEO content that's designed to rank in search engines? We've got your answer...
Read more >How writers can optimize content for a variety of search engines
A walk through the complex process to understand and implement how you can optimize content for search engines beyond Google.
Read more >How to successfully write content for people and search engines
Writing content for people and search engines is not easy. There are different aspects that must be considered for both techniques. Learn how...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Agreed. However, it also seems that we would want Engines to be able to use addons that have
contentFor
hooks. I’m not sure what the best solution here, but I lean towards enablingcontentFor
for an Engine’s addons for consistency, as I believe it is what users would expect.I wanted to add my support for allowing engines to use
contentFor
as well. One of our engines needs to pull in a 3rd party dependency by adding to the index.hrml file. My first thought was that “engines are just a kind of addon,” so I expected it would work, but was surprised to find out that it doesn’t work and to find this issue.