Question

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()
Was it helpful?

Solution

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()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top