Comments (6)
We are using the following workaround in an internal addon we have developed which relies on ember-inline-svg
:
addonPath: function(path) {
if (!this.isDevelopingAddon()) {
path = ['node_modules', this.name, path].join('/');
}
return path;
},
included: function(app) {
var emberInlineSvgOptions = app.options.svg || {};
if (!emberInlineSvgOptions.paths) {
emberInlineSvgOptions.paths = ['public']; // TODO: use ember-inline-svg's defaults directly: https://github.com/minutebase/ember-inline-svg/pull/19
}
var ourPublicPath = this.addonPath('public');
if (emberInlineSvgOptions.paths.indexOf(ourPublicPath) === -1) {
emberInlineSvgOptions.paths.push(ourPublicPath);
}
app.options.svg = emberInlineSvgOptions;
this._super.included(app);
this.addons.forEach(function(addon){
if (['ember-inline-svg'].indexOf(addon.name) > -1) {
addon.included.apply(addon, [app]);
}
});
},
in addition to having ember-inline-svg
in dependencies
rather than devDependencies
for our addon this seems to work well...
from ember-inline-svg.
These issues might be related:
Can we have some workaround until ember-cli/ember-cli#4211 lands?
from ember-inline-svg.
@vitch Thank you so much for sharing! Where does this code go?
from ember-inline-svg.
In the index.js
of the addon which depends on ember-inline-svg
from ember-inline-svg.
@vitch I've tried your workaround and it worked for me. Thank you so much!
The only issue is that and addon's SVGs located at my-addon/public/svg/foo.svg
is accessed via:
According to Ember CLI docs, addon's public folder gets mixed into the app's public folder as a subfolder. For example, when you access the same SVG file via <img>
or CSS, you would do:
.foo {
background-image: url('/my-addon/svg/foo.svg');
}
<img src='/my-addon/svg/foo.svg'>
For consistency, I would like ember-inline-svg
to access files like this:
Can your code be adjusted to achieve that?
from ember-inline-svg.
Have you guys worked out how to import from node modules in a brocfile?
from ember-inline-svg.
Related Issues (20)
- htmlSafe import is causing error in production build HOT 2
- Upgrade Ember.js tracking plan
- Assertion Failed: No SVG found in production / staging HOT 3
- Option to pass styles through the `style` attribute HOT 4
- Babel Deoptimization HOT 1
- Feature Request: Co-locate SVGs within pods HOT 2
- Passing a class to the inline-svg helper overwrites existing classes on the SVG element HOT 1
- Cannot read property 'filter' of undefined
- Fails to find SVG's imported with ember-cli-node-assets addon
- Silently fails with fingerprinted SVGs HOT 4
- Pull from Absolute Path
- Option to receive an action
- Deprecation Warning when updating to ember 2.18.2
- Update SVGO HOT 2
- Would like an option to override the default JS outputFile (currently, 'svgs.js')
- High and Moderate security issues found in yarn audit HOT 1
- Huge number of security issues found in ember-inline-svg HOT 1
- Why is viewBox property removed from svg file? HOT 1
- Convert to component? HOT 2
- SVGs should be bundled to vendor.js instead of app.js
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-inline-svg.