All Projects → lewagon → Rails Stylesheets

lewagon / Rails Stylesheets

Stylesheets starting kit @LeWagon

Labels

Projects that are alternatives of or similar to Rails Stylesheets

Clean Greader
clean-greader is a tiny tiny rss theme based on the latest Google Reader and inspired by other Google Services.
Stars: ✭ 129 (-3.73%)
Mutual labels:  scss
Accecss
AcceCSS A Sass Mixin That debug & check the accessibility of your designs
Stars: ✭ 132 (-1.49%)
Mutual labels:  scss
Gulp Starter Kit
A simple Gulp 4 Starter Kit for modern web development.
Stars: ✭ 134 (+0%)
Mutual labels:  scss
Ng Pi Admin
Angular admin http://treesflower.com/ng-pi-admin
Stars: ✭ 131 (-2.24%)
Mutual labels:  scss
Fusebox Angular Universal Starter
Angular Universal seed project featuring Server-Side Rendering, @fuse-box bundling, material, firebase, Jest, Nightmare, and more
Stars: ✭ 132 (-1.49%)
Mutual labels:  scss
Ng Packagr
Compile and package Angular libraries in Angular Package Format (APF)
Stars: ✭ 1,730 (+1191.04%)
Mutual labels:  scss
Vscode Scss
🔌 IntelliSense for Variables, Mixins and Functions in all Sass (SCSS syntax only) files.
Stars: ✭ 128 (-4.48%)
Mutual labels:  scss
Protonmail Theme
Protonmail Theme
Stars: ✭ 134 (+0%)
Mutual labels:  scss
Mixins
sass mixins
Stars: ✭ 132 (-1.49%)
Mutual labels:  scss
Nextjs Ts
Opinionated Next JS project boilerplate with TypeScript and Redux
Stars: ✭ 134 (+0%)
Mutual labels:  scss
Awesome Sass
Sass is an extension of CSS that adds power and elegance to the basic language. It allows you to use variables, nested rules, mixins, inline imports, and more, all with a fully CSS-compatible syntax. Sass helps keep large stylesheets well-organized, and get small stylesheets up and running quickly.
Stars: ✭ 1,714 (+1179.1%)
Mutual labels:  scss
Pretty Checkbox
A pure CSS library to beautify checkbox and radio buttons.
Stars: ✭ 1,708 (+1174.63%)
Mutual labels:  scss
Paper Kit 2 Angular
Free Bootstrap 4 UI Kit for Angular 2+
Stars: ✭ 133 (-0.75%)
Mutual labels:  scss
Web Starter Kit
Web Starter Kit is an opinionated boilerplate for web development. A solid starting point for both professionals and newcomers to the industry.
Stars: ✭ 130 (-2.99%)
Mutual labels:  scss
Gaohaoyang.github.io
blog & blog theme🤘
Stars: ✭ 1,699 (+1167.91%)
Mutual labels:  scss
Meshki
Meshki: A Black-Colored, Responsive Boilerplate for UI Development
Stars: ✭ 129 (-3.73%)
Mutual labels:  scss
Font Library
📇 An open source project to tag and organize Google Fonts
Stars: ✭ 132 (-1.49%)
Mutual labels:  scss
Balm Ui
♦️ A modular and customizable UI library based on Material Design and Vue
Stars: ✭ 133 (-0.75%)
Mutual labels:  scss
Lc Design
A UI component framework for building LCUI application.
Stars: ✭ 134 (+0%)
Mutual labels:  scss
Basis
A lightweight responsive Sass/CSS framework based on flexible box.
Stars: ✭ 133 (-0.75%)
Mutual labels:  scss

First of all make sure you've created a rails app

rails new APP_NAME

Setup

Ensure you have bootstrap and it's dependencies

yarn add bootstrap
yarn add jquery popper.js

Ensure you have the following gems in your Rails Gemfile

# Gemfile
gem 'autoprefixer-rails'
gem 'font-awesome-sass', '~> 5.6.1'
gem 'simple_form'

In your terminal, generate SimpleForm Bootstrap config.

bundle install
rails generate simple_form:install --bootstrap

Then replace Rails' stylesheets by Le Wagon's stylesheets:

rm -rf app/assets/stylesheets
curl -L https://github.com/lewagon/stylesheets/archive/master.zip > stylesheets.zip
unzip stylesheets.zip -d app/assets && rm stylesheets.zip && mv app/assets/rails-stylesheets-master app/assets/stylesheets

On Ubuntu/Windows: if the unzip command returns an error, please install it first by running sudo apt install unzip.

And the viewport in the layout

<!-- app/views/layouts/application.html.erb -->
<head>
  <!-- Add these line for detecting device width -->
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

  <!-- [...] -->
</head>

Bootstrap JS

Make sure you change the webpack config with the following code to include jQuery & Popper in webpack:

// config/webpack/environment.js
const { environment } = require('@rails/webpacker')

// Bootstrap 4 has a dependency over jQuery & Popper.js:
const webpack = require('webpack')
environment.plugins.prepend('Provide',
  new webpack.ProvidePlugin({
    $: 'jquery',
    jQuery: 'jquery',
    Popper: ['popper.js', 'default']
  })
)

module.exports = environment

Finally import bootstrap:

// app/javascript/packs/application.js
import 'bootstrap';

Adding new .scss files

Look at your main application.scss file to see how SCSS files are imported. There should not be a *= require_tree . line in the file.

// app/assets/stylesheets/application.scss

// Graphical variables
@import "config/fonts";
@import "config/colors";
@import "config/bootstrap_variables";

// External libraries
@import "bootstrap/scss/bootstrap"; // from the node_modules
@import "font-awesome-sprockets";
@import "font-awesome";

// Your CSS partials
@import "components/index";
@import "pages/index";

For every folder (components, pages), there is one _index.scss partial which is responsible for importing all the other partials of its folder.

Example 1: Let's say you add a new _contact.scss file in pages then modify pages/_index.scss as:

// pages/_index.scss
@import "home";
@import "contact";

Example 2: Let's say you add a new _card.scss file in components then modify components/_index.scss as:

// components/_index.scss
@import "card";

Navbar template

Our layouts/_navbar.scss code works well with our home-made ERB template which you can find here:

Don't forget that *.html.erb files go in the app/views folder, and *.scss files go in the app/assets/stylesheets folder. Also, our navbars have a link to the root_path, so make sure that you have a root to: "controller#action" route in your config/routes.rb file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].