Usage without CDN or build step #999
-
|
base on this sample : https://glitch.com/edit/#!/swup-demo-basic I want to do a simple test, I downloaded the script from npm, as shown in the image, the downloaded files are visible, but still when I test with the address , the fade effect does not run. What is the problem? I am testing in Visual Studio Code as a server. What actually happened? 😵💫it now work when i wana test it offline Swup and plugin versions 📝
What browsers are you seeing the problem on? 🧭Chrome Relevant log output 🤓no any error just not work,tested on other browsers too.URL to minimal reproduction 🔗Checked all these? 📚
|
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 13 replies
-
|
I‘ve converted the issue into a discussion as it‘s less a bug report than an implementation question. |
Beta Was this translation helpful? Give feedback.
-
|
I have no professional experience in using bundler or maps or JavaScript. I just want to design a simple control panel for my site that is designed only with jQuery, JavaScript, HTML and CSS and does not depend on any CDN. Everything is local and in the future I want to upload my site and make it online. I would really like to be able to use this script locally and eventually upload it to my own host along with the rest of my pages. If there is a way to solve this problem, please tell me or maybe a small or customized version can be prepared or can be made. Can't all those files that are used with the CDN method be downloaded in one package and downloaded into one folder, like the package I downloaded with npm? Or is this CDN address dependent on node.js and such that it can be done with that method but not locally? If not any way, my goal is to have a simple control panel containing a right panel and a left panel. By clicking on any link or option on the right, only the left panel or environment will display the page I want, with an interesting effect and of course without the need to refresh the page or change the browser address, that is, it will be practically a single page. At the same time, it is important to me that the scripts or written codes or popups, floating dialogs, etc. on the page that It is supposed to be displayed on the left, not corrupted, and executable. Before I became familiar with this script, I found an article in Google searches for my purpose about using iFrame and jQuery, but I don't think it's very interesting and not very professional because each of my second, third, or other pages contains internal effects and internal scripts, and I guess I'll run into trouble with this method. Finally, if you have any suggestions for my purpose, I would be happy to hear them. Maybe there is another or lighter script for this purpose. |
Beta Was this translation helpful? Give feedback.
-
|
Here is an example for you on how to load swup locally without requiring a build step: https://swup-with-local-umd.glitch.me/ The Swup.umd.js build is basically the same as any old JS library. It contains all necessary dependencies and can be loaded via a simple script tag: <script src="Swup.umd.js"></script>
<script type="module" src="main.js"></script>Inside /**
* Swup is available on the window
*/
const swup = new window.Swup();If you don't need your main script to be a <script src="Swup.umd.js"></script>
<script src="main.js"></script>/**
* Swup is available globally
*/
const swup = new Swup(); |
Beta Was this translation helpful? Give feedback.
-
|
Thanks Two questions : So with this method I no longer need the files or folders downloaded in the package and just the Can I test all the other examples in the glitch using this single file or do they require script files or other dependent files? I mean these examples: |
Beta Was this translation helpful? Give feedback.
-
|
For swup core, the For any demos that make use of plugins, like for example the reveal demo, you will need to also download the umd versions of any plugins and load them via script tag, as well. For example for swup/parallel-plugin, it's this: https://unpkg.com/@swup/[email protected]/dist/index.umd.js. You can find the umd version by simply going to https://unpkg.com/@swup/[email protected], unpkg will redirect you to the umd file.
<script src="Swup.umd.js"></script>
<script src="parrallel-plugin.0.4.0.umd.js"></script>
<script src="main.js"></script>/**
* Swup and SwupParallelPlugin are available globally
*/
const swup = new Swup({
plugins: [new SwupParallelPlugin()]
}); |
Beta Was this translation helpful? Give feedback.
-
|
I tried the examples at this address according to the method you mentioned: I am currently stuck at this point (fragment-support-modal section) : and the effect is not being displayed correctly. What is the reason?
Does it need any other dependent files? The examples before this section all worked fine and operated correctly, but why is this section not working? |
Beta Was this translation helpful? Give feedback.
-
|
I mentioned the same thing in the previous text. The files I renamed were usually the same file I also mentioned that everything was working fine until Example fragment, but I ran into a problem in this part. |
Beta Was this translation helpful? Give feedback.
-
|
Please learn these things and then come back here:
Thank you. |
Beta Was this translation helpful? Give feedback.
-
|
Came back because you wanted ;) , now you have to stay here and read these kid for a few times, ok? good job :3 Explain Again just for you :
https://swup.js.org/getting-started/demos/#fragment-support-modal the only change is the download of the main files (index.umd.js of each plugins as mentioned before twice) and the addition of a few short lines in the script address section also clear at images and uploaded as a rar and zip files (you can see clear)
But it seems that you are having a hard time understanding my content, so don't waste any more of my time, and if you know there are problems with your script, fix it. I don't have time to listen to useless and worthless content. Whenever you solve the problem, come back and announce the result to everyone.good kidy kid. |
Beta Was this translation helpful? Give feedback.




Here is an example for you on how to load swup locally without requiring a build step:
https://swup-with-local-umd.glitch.me/
The Swup.umd.js build is basically the same as any old JS library. It contains all necessary dependencies and can be loaded via a simple script tag:
Inside
main.js:If you don't need your main script to be a
module, you can even access Swup directly, withoutwindow.Swup: