Comments (17)
Great idea @asiyani!
We should probably have an option to add libraries which will open a modal dialogue. We can then have the user put in a link to the JS file they want. In addition to this we can have some preset ones like Lodash etc.
Checkout codepen.io/pen and click on settings > javascript to see what I have in mind.
from esfiddle.
yes, but problem with adding own library in like in codepen is you need to write some boilerplate code before you can actually do what you wanna do.
Atleast in most used library user should be able to just select library and start writing actual code.
e.g. -> user will select lodash -> then just write console.log( _.now() ) this should work.
So we will have to do all background work like requiring lodash and assigning it to _ var. runkit Link
from esfiddle.
@asiyani Yeah that sounds a good idea. Yeah I think we can stick with the UI we have but skirt over the boilerplate that codepen requires.
from esfiddle.
@joshghent I think we should use jQuery to handle this. This method is perfect for it: http://api.jquery.com/jQuery.getScript/
I can go ahead and implement it, if you want.
from esfiddle.
from esfiddle.
@joshghent I was thinking of doing something like this: http://codepen.io/velascoDev/pen/wgbZQL?editors=1111
but I'm not sure if it would work with the babel compiler.
Idk about just one method, but using this approach: http://developer.telerik.com/featured/jquery-using-only-what-you-need/
we can require only the jQuery AJAX module, which is 13K when compressed.
from esfiddle.
As for using the cdnjs API, I'm not sure about how to execute the response file properly. How would you go about that?
from esfiddle.
@velascoDev Sorry for not getting back to you. I would run a query for the library that the user requested and then get the URL of that library and load it in as a script element.
I'm not 100% sure however as in the case of some libraries there are multiple prerequisites. For example to load bootstrap.js you first need jquery.
I'll have a think about how best to go about this. It could be that we have a table of libraries and a link to their CDN file or something like that? Have you had any more thoughts.
Yeah we could require just that module. I'd prefer if we could do this all in JS but if it significantly helps then that would be the route to go (importing just the methods we need)
from esfiddle.
found this blog it addes script tag to head and calls callback function
Implemented same using cdnjs Not sure how to load specific version for the best way we can implement that....code pen
I think if we do this way we might have to remove script tag from head once fiddle is done or new fiddle is loaded.
from esfiddle.
@asiyani Yeah I'm happy with this approach. Is that something you or @velascoDev would be up for doing?
from esfiddle.
@joshghent is it still open? I am up for it.
from esfiddle.
@isaeef Yes this is still open, we would really appreciate you're help on this one! Let us know how you get on 👍
from esfiddle.
We can get a js file by xmlhttprequest and eval it, or create a dynamic script tag like @asiyani said
from esfiddle.
@phsantiago I think a dynamic script tag would work best and be most safe. eval
scares me.
Is this something you'd want to take on?
from esfiddle.
@joshghent Can you please check #174
Based on the discussion you and @asiyani had, I have added this which can be improved based on your inputs.
from esfiddle.
@jigar1101 @asiyani Updated the PR with some comments. Looks like it will need catching up with the latest version of the develop
branch where I have fixed babel but looks great! 💯 Thank you so much for this work! 🎉
from esfiddle.
Great 👍
from esfiddle.
Related Issues (20)
- Create About Page
- Dark/Light mode switch doesn't update theme dropdown element HOT 2
- Switching from Dark to Light mode and refreshing causes bug
- New Maintainer HOT 13
- Port to GitHub Actions HOT 1
- Fix Embedded View and Create test case HOT 1
- Fix tweet share button HOT 1
- Fix Github gist export HOT 1
- New Code Examples! - On going project! HOT 3
- Improve mobile view HOT 1
- Create github actions Docker pipeline HOT 6
- Create new homepage HOT 1
- Improve fiddle site speed - Multiple PR's welcome! HOT 1
- Change master branch to main HOT 2
- Resolve deprecated dependencies (multiple PR's welcome) HOT 4
- Minify Javascript source HOT 5
- Add Lighthouse CI HOT 2
- Remove unused Javascript HOT 2
- ES7 -2017 - Async-await best practice example HOT 4
- esfiddle.net website is not working HOT 4
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 esfiddle.