Skip to content
This repository was archived by the owner on Jun 23, 2026. It is now read-only.

Add ability to provide default JavaScript load paths - #75

Open
DEfusion wants to merge 5 commits into
cowboyd:masterfrom
bandzoogle:master
Open

DEfusion wants to merge 5 commits into
cowboyd:masterfrom
bandzoogle:master

Conversation

@DEfusion

Copy link
Copy Markdown

This allows us to add our own load paths and thus load external JavaScript files such as custom less functions. For example we could do the following, note for this to work the gem must not be required by the Gemfile due to auto initialisation of the loader.

  module Less
    module Defaults
      def self.extended(base)
        base.javascript_paths << ::Rails.root.join('lib', 'assets', 'javascripts')
      end
    end

    module Customisations
      def self.included(base)
        loader = base.instance_variable_get :@loader
        loader.require('less/custom-less-functions')
      end
    end
  end

  require 'less'

  module Less
    include Less::Customisations
  end 

DEfusion added 5 commits June 30, 2014 15:32
This allows us to add our own load paths and thus load external JavaScript files such as custom less functions
This reverts commit b881e0c.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants