-
Notifications
You must be signed in to change notification settings - Fork 88
Description
I'm trying to get sprockets to preprocess a file that contains a directive so that when I require()
using browserify, it will contain the generated JavaScript.
This is my setup (within app/assets/javascripts
):
system/
rails_routes.js
application.js
application.js
is the main file, and it starts the rest of the application. I would like to be able to do something like
var rr = require("./system/rails_routes.js");
in it.
In system/react_routes.js
, I have the following:
//= require js-routes
console.log("Does this work?");
As an aside, I also configured js-routes
to place the output in an object called module.exports
, so to comply with the CommonJS model, as described in railsware/js-routes#121.
The only issue is that when I look at the generated bundle, the sprockets directive is still there and has not been expanded.
Is there a way to get this to work? What is the correct way to have sprockets preprocess a file before bundling it with browserify-rails?