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

What is Framer? Join the Community
Return to index
Jon Gold
Posted Jul 23 - Read on Facebook

Structuring quite a complex prototype I came to use CoffeeScript classes (extending Layer) for each of my components. Quite nice because you can set default properties and add methods specific to components to their…prototype. Just wondering if that's legit/will break anything/anyone has opinions about that.

12 Comments

Jon Gold

(but I'm really seeing the value of using coffeescript vs. js here - makes things so clean)

Koen Bok

Super legit. Welcome to the next level©

I do this all the time in my own prototypes too. An example from the source is BackgroundLayer: https://github.com/koenbok/Framer/blob/master/framer/BackgroundLayer.coffee

Jon Gold

ahah that's great, cheers Koen. I was doing my constructors in a slightly different way; yours looks more sane.

next on my hitlist is splitting it all up into different files - hit several hundred lines yesterday; getting pretty intimate with my scroll wheel… don't suppose Framer Studio compiles Browserify modules? or should I use Utils.domLoadScriptSync? couldn't find any examples of that - sure I've seen people doing it before though.

Koen Bok

There is no "official way" of doing that, but surely everything that normally works in a browser works. So you can add a script tag to the header or load the library sync or async.

We need to standardize this in the future, so I'd love to hear what works well for you.

Aaron Carámbula

Woah. Do you see the matrix?

I was wondering if studio could have something like pragma mark that helps navigate long code, and then add in (automatic?) code collapse for those sections. That could make global search still very easy (expands the sections and just searches through) but make >100 lines useable.

Jon Gold

like ctags?

Aaron Carámbula

I haven't used ctags, are they intra file or inter file? Pragma is inter file, creates an index you can jump to from a select box in codes chrome.

http://nshipster.com/pragma/

Jon Gold

yeah I'd say they're pretty similar - probably not as powerful as what you get in Xcode, but they do the job when you're not writing obj-c. I haven't set it up on my new Mac; here's an example screenshot of how they work in Vim http://majutsushi.github.io/tagbar/tagbar3.png (but you can do the same thing in Sublime/Atom/etc etc too)

Elliott Kember

https://gist.github.com/elliottkember/7ef93572ef71d4561091 - a little "load" convenience function I've used a couple of times.

Elliott Kember

https://github.com/elliottkember/Framer/commit/472546824b5396db0b1ce39f144991ceabc3df28 for Utils integration. Probably not the right idea to do an in-line include like that, though.

Aaron Carámbula

+1, dig this. I think loading more script and other libraries is one set of problems, managing code is another, both would be awesome to have.

Also, you dudes have nice sunglasses.

Elliott Kember

😎

Read the entire post on Facebook