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

What is Framer? Join the Community
Return to index
Zachary Russell Heineman
Posted Feb 27 - Read on Facebook

Is there a best-practice way to break up a Framer Studio project into multiple files to keep code organized (and each file a manageable length)?

2 Comments

Zachary Russell Heineman

How about any good way? (That has worked well in practice.)

Johnny Chen

I've also struggled with this problem as I find that I'm already at 1500 lines of code. My solution is brittle but it works for me right now.

Basically, I edited "../framer/init.js" and the "#loadProject()" method to also load my other *.coffee files.

Looks like this,

I'd be happy to hear about other ways to do this.

==
/**
* Customized to load the "lib.coffee" source and concatenate w/ app.coffee
*/
function loadProject() {

xhr0 = new window.XMLHttpRequest()
xhr0.open("GET","lib.coffee", false)
xhr0.send(null)
var libSrc = xhr0.responseText

xhr1 = new window.XMLHttpRequest()
xhr1.open("GET","party.coffee", false)
xhr1.send(null)
var partySrc = xhr1.responseText

xhr = new window.XMLHttpRequest()
xhr.open("GET", "app.coffee", true)

xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && xhr.responseText != "") {
CoffeeScript.eval(
libSrc
+ "\n\n"
+ partySrc
+ "\n\n"
+ xhr.responseText)
}
}

xhr.send(null)

}

Read the entire post on Facebook