Fit container - #19
Conversation
…pectRatio=xMidYMid slice to fit container element && update svgo to 1.3.2
| it("should ouput the optimized svg code...", async () => { | ||
| // Init bundler | ||
| const bundler = new Bundler(path.join(__dirname, './llama.svg'), { | ||
| const bundler = new Bundler(path.join(__dirname, './llama.isvg'), { |
| @@ -1,3 +1,3 @@ | |||
| module.exports = function (bundler) { | |||
| bundler.addAssetType('svg', require.resolve('./asset.js')); | |||
| bundler.addAssetType('isvg', require.resolve('./asset.js')); | |||
There was a problem hiding this comment.
are you proposing to replace svg with isvg?
There was a problem hiding this comment.
yes, using svg chould conflict with other technic, when developer write svg path in scss , vue or something, this project has big difference between file loader , it does not produce a new file, so make it has a unique extension avoiding conflict with other file loader, also sound reasonable.
There was a problem hiding this comment.
unless the asset extension hook can have known the svg module import from which kind of file or in which way, this is the simple solution.
There was a problem hiding this comment.
Yeah the isvg thing seems odd to me, but it is pretty intuitive, as long as it's documented properly... My only issue is that I would be pulling .svg files from another package, and I would not be able to change the file extension within that package without copying the SVGs out...
@bung87, can you give a code example that shows where this plugin would mess up usage of .svg in SCSS or Vue? I'm not sure I understand, and it might be something worth elaborating on in the documenting for the .isvg extension.
There was a problem hiding this comment.
@lazd it's described in #13
as it's a asset any other loader would transpile the svg module to a file path when you import it, you can simply create a project that contains scss , set a background to a svg file,then in js file import it, or in vue SCF write style refers to it , as the developer intend to refers a file, but this plugin is about generate inline code , that's not the right use case, also other plugin process would give a path as result.
I understand your use case , it make sense.
if remains the svg extension, this plugin should detect user import it in which file, it makes more complicated, since other process would interupt, or like webpack add some command in file path when user import it xxx.svg!inline or something.
There was a problem hiding this comment.
about your use case ,maybe can use .flowconfig module.name_mapper https://parceljs.org/module_resolution.html#flow-with-absolute-or-tilde-resolution
|
@albinotonnina what are we thinking on this one? It looks like it might make this plugin usable again... |
|
@lazd, @bung87 thanks for the work you've doing on this. @lazd so you say that this PR with the new constrain of a custom extension for svgs would make the plugin usable again? Then I'm in. But I'm a bit confused now with the 2 PRs @bung87 opened.
Thank you |
No description provided.