Using Sprockets in Coffeescript, how do you //require?
Asked Answered
P

1

5

Currently, I have my all.js file with this:

//= require jquery
//= require jquery.nicescroll.min
//= require bootstrap.min

$(document).ready(function() {
    $('.carousel').carousel();
    $('html').niceScroll();

});

I would like to move it into an all.js.coffee, complying with the instrucions here. How do I go about doing that because the //= results in a compile error.

//= require jquery
//= require jquery.nicescroll.min
//= require bootstrap.min

$(document).ready ->
    $('.carousel').carousel()
    $('html').niceScroll()
Photodynamics answered 14/11, 2013 at 6:13 Comment(0)
S
10

From the fine manual:

Supported Comment Types

The directive processor understands comment blocks in three formats:
[...]

# Single-line comment blocks (CoffeeScript)
#= require foo

so presumably you'd say:

#= require jquery
#= require jquery.nicescroll.min
#= require bootstrap.min

$(document).ready ->
    $('.carousel').carousel()
    $('html').niceScroll()
Selfreliant answered 14/11, 2013 at 15:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.