Middleman Path for Assets folder

Hi people,
I am a newbie in Middleman. I have a created project in middleman, and am trying to use a different path for the javascripts Assets dir then the default path.
In order for this to work, I added the following to my config.rb:
config[:js_dir] = “ofir/files/javascripts”

and then I put my files in the following location : “#ROOT/source/ofir/files/javascripts”
and then I removed my “#ROOT/source/assets” folder.

Running middleman failed miserably.
What other changes Am I required in order for it to work?

Thanks,
Ofir

Try following syntax instead, with single quotes:

config[:js_dir] = 'ofir/files/javascripts'

It looks like you had missing closing quote, but copy-paste code snippet above and replace yours. Make sure to re-start middleman server once you do it.

1 Like

How did you check whether or not it works? Have you been trying to use “stylesheet_link_tag” helper or something else that requires this path to be set correctly?

You can check if your setting of new javascript location is working at http://localhost:4567/__middleman/config/

And if it is, then you can check if this location is indeed correct path by looking at your website structure, as seen by Middleman, at http://localhost:4567/__middleman/sitemap/

Hi Rafael,

Yes, I indeed added a stylesheet link tag before I asked the question.
It still not solving the situation.
thanks for the tip about the config URL.
Again, :hashicorp has no option to revert the default RAILS style of paths,
well, at least not one I have found.
This is the one gem that is miss-behaving.

See if removing (commenting out) problematic gem will resolve the issue. If yes, then you will know that this is where you need to seek for solution, not general config.

Also, does hashicorp works with default paths (if you move files to default paths, of course)?

I now realized that all asset paths (js, css, images, layouts) are relative to source directory.

So, all you need to do is to set:

config[:source] = 'ofir/files'

and REMOVE all other directory configs you posted, as default relative paths are correct. Until you change config for source directory, Middleman assume it is source directory, which in your case isn’t the case.

If this still doesn’t work, you need to post directory structure of your Middleman directory (that is: one where there is config.rb file; this is the same one where you run middleman server from), so that I can see what does it look like.

The solution was leaving the assets folder and uniting scripts, stylesheets, layouts in a way that all will be in a single path : “assets”. again, hashicorp gem must have this name.