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

What is Framer? Join the Community
Return to index
Matthew Wagerfield
Posted Sep 08 - Read on Facebook

Hey everyone, is there a way of requiring modules outside of a .framer project? I have a series of .framer projects within a directory that I want to share common code between and don't really want to be copy and pasting these files into each of my .framer project's modules directory as they could easily fall out of sync.

As a programmer, I am used to being able to require modules outside of a directory by doing:

var myModule = require('../../some/folder/myModule');

...but this doesn't work inside Framer Studio. I appreciate that the CoffeeScript compiler might only be looking at files within the .framer project, so I'm happy to write my external/shared modules in JavaScript.

Could someone please tell me if this is possible, or what the best solution is for keeping this files in sync. I don't really want to publish my modules to NPM...

4 Comments

Jordan Robert Dobson

Isaac Weinhausen was mentioning something yesterday that he was doing.

Isaac Weinhausen

I've been facing a similar problem for my Animation Collections project. https://github.com/isaacw/framer-animation-collections

In the root, I have a 'master' Framer project and an examples folder, filled with additional Framer projects showcasing various ways to use my classes. I was constantly copying and pasting modules between my examples and the master project. That's straight up annoying and makes your git history messy. I considered writing a build script, but which one do you pick? https://medium.com/fear-and-coding/grunt-vs-gulp-vs-make-vs-rake-vs-jake-vs-cake-vs-brunch-vs-ant-vs-maven-vs-bash-vs-you-6a149329f050#.hpt32iimr And who has time for this anyways when you're trying to be quick and scrappy?

After racking my brain, it hit me, "use symbolic links stupid!" I replaced all my module folders in my example projects with symlinks pointing to the master file. Now in my git project, I only have one set of modules to keep track off. Problem solved!

Creating symlinks is easy, and can point to relative paths. Here: http://apple.stackexchange.com/questions/115646/how-can-i-create-a-symbolic-link-in-terminal

Jordan Robert Dobson

Thanks Isaac I might have to try this today.

Matthew Wagerfield

Thanks for your solution Isaac, I was considering using SymLinks, but was hoping there was a 'better' way that wouldn't tie the project to my machine's virtual filesystem. I could write a little bash script that did this when the project is shared between machines, but that solution is far from ideal and feels a bit hacky to say the least!

I appreciate that Framer is purposefully designed to veer away from large, multi-file projects, but the introduction of modules by request of the community—and the potential they bring for more sophisticated projects—feels somewhat stifled by this restrictive implementation.

Read the entire post on Facebook