svg.filter.js icon indicating copy to clipboard operation
svg.filter.js copied to clipboard

Is it work with svg.js 3.0 ?

Open VitaliyAT opened this issue 4 years ago • 2 comments

Draw line, add first filter in example

image.filterWith(function(add) {
  add.gaussianBlur(30)
})

IF Put it (svg.filter.js) in html after svg.js AS IS:

<script src="js/svg.js"></script>
<script src="js/svg.filter.js"></script>

THEN But get in console:

Uncaught SyntaxError: Cannot use import statement outside a module

ELSIF AS IS (type="module" added):

<script src="js/svg.js"></script>
<script type="module" src="js/svg.filter.js"></script>

THEN

Uncaught TypeError: Failed to resolve module specifier "@svgdotjs/svg.js". Relative references must start with either "/", "./", or "../".

"@svgdotjs/svg.js" installed through npm as:

npm i @svgdotjs/svg.js --save-def

"@svgdotjs/svg.filter.js" installed as:

npm i @svgdotjs/svg.filter.js --save-def

"dependencies": {
    "@svgdotjs/svg.js": "^3.0.16",
    "@svgdotjs/svg.filter.js": "^3.0.7"
  }

VitaliyAT avatar Jun 05 '20 12:06 VitaliyAT

Short answer: Yes, it's work. Long answer:

  1. Go to https://github.com/svgdotjs/svg.filter.js/releases
  2. Download zip, open, take "min" version
  3. Use "min" version in project.
  4. Get clear console.

Tested - it's work. Don't know why so, why errors with full version. Don't understand how npm installation can help. Don't understand why in readme.md have no such information - just 1 npm's line and "think what you want and use it somehow, how you don't know". Why it's a secret? Why so not welcome? Don't see any button in github from project to releases. Only direct typing URL (as higher) give me releases.

I am working under localhost:3000 server organized through "browser-sync". Project should do the same - it's not web site, it's web face for PLC. That's why I need all from localhost. But anyway it's does not mater from what point it will work. Look on facts: full version not work. By the way, svg.path.js - work OK from localhost and full version. Why svg.filter.js is not?

VitaliyAT avatar Jun 05 '20 15:06 VitaliyAT

Its there:

Unbenannt

The file you include via script tag is a bundled (generated) file. There is no value in putting it into the source code because its not source. Therefore it is published as release AND published with npm. It is common among libraries to populate their distribution files in the folder "dist". So when you install this package via npm or yarn you will find the bundled files in the dist folder of the svg.filter.js package.

svg.path.js is not maintained by me. It depends on a global variable SVG which is NOT available when you use esm imports. So yes, it works for you (which is the "old" way) but not for users using esm imports

Why it's a secret? Why so not welcome?

Feel free to improve. I am a single person maintaining more than 10 repos and a documentation. I have only so much spare time at my hand and cant possibly see everything. Thats why it is open source. Everyone can help

Fuzzyma avatar Jun 05 '20 23:06 Fuzzyma