Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Sprockets in Coffeescript, how do you //require?

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()
like image 975
Daryll Santos Avatar asked Nov 14 '13 06:11

Daryll Santos


1 Answers

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()
like image 186
mu is too short Avatar answered Sep 21 '22 11:09

mu is too short