Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialjoseph arias
9,269 PointsHow can I make this work in Codepen?
Heyy guys soo my code works fine on Workspace but when I try to add my code to CodePen the songs don't display on the html? Not sure what's going wrong since it works on Workspace. Everything was copied and paste to the Codepen expect for the Script tags in the HTML. Anybody has an idea why it's not displaying on CodePen? Anyone know how to properly combined all 3 JS files into one? Apparently copy and paste doesn't work.
4 Answers
Steven Parker
231,275 PointsYou may indeed have to combine your JavaScript into a single file.
Unlike workspaces, on codepen there's no associated disk storage to load modules from. So you will probably need to combine all the individual JavaScript files to go into the single JavaScript pane on codepen. You would have a similar task if your project involved multiple CSS files.
But once properly combined, the project should operate there.
joseph arias
9,269 PointsI carefully copied all Javascript code files and paste it into the JavaScript portion of Codepen. Nothing is working tho. Not sure why. Checked Workspace and everything is working there.
joseph arias
9,269 PointsAnyone know how to properly combined all 3 JS files into one? Apparently copy and paste doesn't work.
Steven Parker
231,275 PointsRemember to any references to external files and make sure they are combined in an order that will not result in undefined references as the code runs.
If you have a codepen account, you can save your work there and post a link to it here.
joseph arias
9,269 PointsSteven Parker Abdulwahab Alansari... Here's my Codepen. I Stop where the songs were supposed to appear in the the Html so I didn't add the button function. I don't understand why it's not displaying on codepen if it works on workspace. Is my code in order? I appreciate the help guys. I'm really lost in here.
joseph arias
9,269 PointsNevermind guys I figure it out.. I didn't see that there was a order in the files in index.html file below the script tag. I was just copying and pasting stuff but I wasn't putting it in order. I wish Andrew Chalkley would have done it in one file instead of many files and did this code in order from start to finish so people like me can understand it better and put it into practical.
Steven Parker
231,275 PointsActually, placing code in multiple files is quite practical.
It can simplify maintenance to break the code up into separate files as shown in the course.
The restriction of codepen is not something you would likely deal with in a real-world development situation.
Congratulations on resolving your issues.
And I did mention the importance of combining in the right order.
Abdulwahab Alansari
15,151 PointsAbdulwahab Alansari
15,151 PointsI really need to see an example to tell what's wrong