Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to provide default JavaScript load paths #75

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

DEfusion
Copy link

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 

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants