Giter Site home page Giter Site logo

remote-sass's Introduction

Remote::Sass

RemoteSass is a small gem that allows Sass to import remote sass/scss stylsheets over HTTP/S. With this, you can set up a central server to serve your stylesheet assets and share css among your many applications.

Installation

Add this line to your application's Gemfile:

gem 'remote-sass'

And then execute:

$ bundle

Or install it yourself as:

$ gem install remote-sass

Usage

You'll need a couple of things for this to work: First, you need a remote server capable of serving sass/scss assets. Then you need to give RemoteSass the base url where your remote assets are located (preferably somewhere in an initializer file before your app starts up), ex:

RemoteSass.location = "http://remote-server.com/path/to/assets/"

From this, RemoteSass will add your remote server as the last part of Sass's lookup path. When importing, Sass will initially look for the file at the filesystem level first; if it finds the file, no extra connection is made. If it fails to find a matching file, it will try to make a remote connnection to your defined server to find the file.

Example:

@import "css/colors";

Sass will first try locally find a sass/scss file at "css/colors.(sass|scss)". Failing this, it will look to RemoteSass to connect and import remotely from the base path you set above (in this case, from http://remote-server.com/path/to/assets/css/colors.(sass|scss)"). Be aware of this look up order in case Sass doesn't seem to be loading the file you want.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

This code is dual licensed under the Beerware / Lunchware license. See below for details:

THE BEER-WARE / LUNCH-WARE LICENSE (Revision 42):
<[email protected]> wrote this file. As long as you retain this notice you
can do whatever you want with this stuff. If you meet an author of this code one day, 
and this code was helpful to you, you must buy the author a beer and/or lunch 
in return as payment.

remote-sass's People

Contributors

joeellis avatar

Watchers

Carlos Vilhena avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.