Project

gkss-rails

0.0
No commit activity in last 3 years
No release in over 3 years
A drop-in, easy-to-use, gorgeous-by-default Rails plugin you can put into your projects so you can instantly have cute docspec.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0
>= 0
>= 0
>= 3.2.0
 Project Readme

Goshan KSS

This is a living styleguides tools based on https://github.com/dewski/kss-rails and http://nadarei.co/nkss-rails/

Installation

Add this line to your application's Gemfile:

gem 'gkss-rails'

And then execute:

$ bundle install

Then, install the needed files into your project:

$ bundle exec rails g gkss:install

Add assets path into config/initializers/assets.rb

Rails.application.config.assets.precompile += %w( jquery-1.8.0.min.js prettify.js prettify.css styleguide.css )

Now move on to the next section.

Customization

This gives you the following things that you should customize:

  • config/styleguides.yml Config your kss with title, root, sections
    title means Application's title root means which css file should be searched, default is app/assets/stylesheets include_js and include_css means which manifest js and css file shoud be included in styleguide page, defualt is application section is sub pages which show your guides

  • app/views/styleguides/ Put your guide haml view here, make file name is id defined in sections of config/styleguides.yml

Viewing your sheets

Now visit http://localhost:3000/gkss. It should work straight away. By default, it's only enabled in development mode.

This works because you have a new route added to your app that mounts the Gkss engine to that path:

Rails.application.routes.draw do
  ...
  mount Gkss::Engine => '/gkss'  if Rails.env.development?
  ...
end

Document your CSS

In your CSS file, add a KSS document block. In this example, we'll define section 1.3. Refer to the KSS Syntax page for more info.

/*
 * Buttons (.button):
 * A button for doing things.
 *
 * Styleguide 1.3.
 */

.button {
  color: red
}

The format for the first line is name (code):, where name describes the section you want to document, and code describes the CSS selector of it.

Thanks!

License

MIT License

Copyright 2017, Han Qiu(goshan), All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.