Roda's assets plugin and bootstrap-sass

210 views
Skip to first unread message

Aaron Tinio

unread,
Sep 30, 2015, 11:48:54 PM9/30/15
to Roda
Hi Jeremy,

First of all, thank you so much for all your hard work on your open source projects!

I'm trying to use the assets from the bootstrap-sass gem with Roda's assets plugin.
So far, this is what I have:

```
plugin :assets,
  css: 'app.scss',
  js: [
    Bootstrap.javascripts_path + '/bootstrap.js',
    'app.js',
  ],
  dependencies: {
    Bootstrap.stylesheets_path + '_bootstrap.scss' => Dir[Bootstrap.stylesheets_path + '/**/*.scss'],
  }
```

The app.scss asset with its @imports is served just fine. The problem is the absolute path to the bootstrap.js asset.
Here is the generated src tag:
```
<script type="text/javascript" src="/assets/js//home/aaron/.gem/ruby/2.2.3/gems/bootstrap-sass-3.3.5.1/assets/javascripts/bootstrap.js"></script>
```

Is there a way of using the bootstrap.js assest from the bootstrap-sass gem with the assets plugin?

Jeremy Evans

unread,
Oct 1, 2015, 4:04:13 AM10/1/15
to Roda
Not currently.  Currently, all asset files rendered by the plugin must be inside the assets folder.  One simple workaround is to copy, hard link, or symlink the asset files from the gem to the asset folder.  Another option is using a custom Tilt handler that will load the files from the gem.

Thanks,
Jeremy

Aaron Tinio

unread,
Oct 1, 2015, 1:07:07 PM10/1/15
to Roda
Unfortunately, I can't use a hard link or symlink as I'm not sure where the gems are installed on my production server.
But you gave me an idea! I might be able to use an erb template which reads the gem's asset file.

P.S. It worked! Thanks again Jeremy!

Jeremy Evans

unread,
Oct 1, 2015, 1:25:10 PM10/1/15
to Roda
On Thursday, October 1, 2015 at 10:07:07 AM UTC-7, Aaron Tinio wrote:
Unfortunately, I can't use a hard link or symlink as I'm not sure where the gems are installed on my production server.
But you gave me an idea! I might be able to use an erb template which reads the gem's asset file.

P.S. It worked! Thanks again Jeremy!

Great!  I've just pushed up a tilt-indirect gem that may make things easier for you: https://github.com/jeremyevans/tilt-indirect

Thanks,
Jeremy

Aaron Tinio

unread,
Oct 1, 2015, 8:02:08 PM10/1/15
to Roda
On Friday, October 2, 2015 at 1:25:10 AM UTC+8, Jeremy Evans wrote:
Great!  I've just pushed up a tilt-indirect gem that may make things easier for you: https://github.com/jeremyevans/tilt-indirect

Awesome! I'll check it out. Thanks so much! 

Aaron Tinio

unread,
Oct 6, 2015, 8:55:12 PM10/6/15
to Roda
I just found out about tilt-pipeline. This is great! Thanks Jeremy!
Reply all
Reply to author
Forward
0 new messages