This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Noam Elbaz
Posted Jan 21 - Read on Facebook

Hey everybody: sometimes my Framer file get really long and unmanageable. I basically learned code through FramerJS. How can I break my framer.js file in to parts. and hook them up together? Can I make a function in a separate file and reference it in framer.js? How do I tell framer.js file about the other js file?

7 Comments

Joel Leví Hernández

I got to this same point, my Framer project was over 1k lines and going up and down became a major time waste, I decided to go with Framer as a pure java script library, I'm using it with sublime text where Framer plugins exist, I separate it into components, sections and pages (this is purely your choice of project structure), I defined constants to whether start with the original app flow, or a particular page itself (for development purposes) it has become hugely manageable, I can now truly work in a repository with other developers with huge ease. So to conclude, I went full javascript, after that, personal project management techniques apply. Good luck!

Nick Bewley

Joel: Share a sample repo??

Joshua Tucker

Yes. You will need to read-up on how you would best put that JS file together. I have only added existing JS files to Framer, but here's how you do that.

- Place the JS file where you want (typically I put ones I reference in [project_folder]/framer
- Open index.html from the root project folder in an editor (I use Xcode)
- Add a <script src="framer/[name_of_file].js"></script> below the others
- Save

Now it's able to be referenced in that project.

Koen Bok

We're working on a better way to do this.

Noam Elbaz

Koen Bok thanks. exciting. Joshua Tucker ... and then how do i use the function that is in the second JS/coffee file? DO i just use it or do I have to use some dot notation like other_js_file.exampleMethod( ) ?

Joel Leví Hernández

At the moment the project I'm working on is still under a non disclosure clause, It will soon be terminated and I will open the repository to anyone. Noam

Joshua Tucker

Noam Elbaz As long as the method doesn't conflict with other methods in other files (in terms of method name), you should be able to call it directly like exampleMethod().

Read the entire post on Facebook