GithubHelp home page GithubHelp logo

compass-sinatra's Introduction

This app is a simple starting point for those wanting to explore compass with sinatra.

Quick start:

Clone this project:

git checkout https://[email protected]/rubycut/compass-sinatra.git

Prepare dependencies:

bundle install

Run this app:

rackup

Point your browser to http://localhost:9292/

Start playing, important files to play with:

  • views/index.haml
  • views/css/_base.sass <--- Grid options
  • views/css/screen.sass <--- Layout

Susy

This repo bundles susy plugin together with compass.

What is going on

Compass

Sass basically allows you to write nicer css, it supports variables and some other stuff.

But compass , goes a step further: "The compass core framework is a design-agnostic framework that provides common code that would otherwise be duplicated across other frameworks and extensions."

This means it it gives you sass tools so you don't have to start from scratch on every new project and duplicate code. Most important of all, compass also supports plugins.

I started this project with command:

compass create . --require susy --using susy --syntax sass --sass-dir views/css

which creates 3 files only:

  • config.rb
  • views/css/screen.sass
  • views/css/_base.sass

_base.sass is where you load susy plugin and set options for plugin.

screen.css is where you define placement of your blocks into grid

Sinatra full auto

When you start sinatra app, it will generate css on the fly, see app.rb for details. Basically it just load Compass before calling sass method.

Manual creation

out of this 3 files, it creates stylesheets/screen.css every time your run compass compile or compass watch for example if you want to use it some other projects which are not ruby.

config.rb is compass configuration which is loaded every time, it remembers your create command, so you don't have to enter same options again and again. It also gives you ability to customize your target stylesheets/screen.css file.

Conclusion

As you can see, result of using compass with plugins is one css file only. You can generate it on the fly with sinatra or manually using compass compile or compass watch

compass-sinatra's People

Contributors

agnoster avatar chriseppstein avatar micahelliott avatar rubycut avatar seaofclouds avatar

Stargazers

 avatar

Watchers

 avatar  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.