Code Monkey home page Code Monkey logo

rails-partial's Introduction

Sublime Text 2 plugin: Rails Partial

Makes creating Rails Partials a breeze. Quickly create a blank Partial, or select text and create the partial instantly!

Shortcut Keys

There are two shortcuts, "Create Partial", and "Create Partial and Open". The latter option simply loads the partial into Sublime Text after creating it.

Windows / OSX / Linux:

  • ALT+P - Create Partial
  • SHIFT+ALT+P - Create Partial and Open

How to Use

The following instructions are all done inside your Rails Apps's view (.erb, .html, .haml, .slim) or stylesheet (.css, .scss, .sass) files.

Creating a Partial from Code

  1. Select the block of code you wish to put into a partial and hit the Shortcut Key
  2. Name the Partial (the preceding underscore and the file extension is not required)
  3. Hit Enter. Done! Your partial is located in the same directory as your original file.

Creating a Blank Partial

If you do not select any code before hitting the shortcut key, this plugin will simply create a blank partial file and insert the render/import code in your view/stylesheet as appropriate.

Creating Partials in other directories

If you wish to create your partial in a different directory, simply type the directory name followed by a slash and the partial name. For example:

To create a partial inside of app/views/shared/_partial_name.html.erb (a common directory belonging for your views), you would type: shared/partial_name. You could also enter common/partial_name as well as somedir/subdir/partial_name.

Importing Stylesheets

The same methods above can be applied to your .css, .scss/.sass files. Try it out!

Limitations

This plugin has support for the following file types:

  • Markup: .erb, .html, .haml, .slim
  • Stylesheet: .css, .scss, .sass.

This list will possibly be expanded in the future. If you would like support for other files, please submit an issue or an pull request.

Installation

You have two options, we'll start with the preferred installation method, Package Control.

Package Control

The easiest and preferred way to of installing this plugin is with Package Control.

  • Ensure Package Control is installed and Sublime Text 2 has been restarted.
  • Open the Command Palette (Command+Shift+P on OS X, Control+Shift+P on Linux/Windows).
  • Select "Package Control: Install Package"
  • Select Rails Partial when the list appears.

Package Control will automatically keep Rails Partial up to date with the latest version.

Git

This method required a little more work, but simply clone this repo into your Sublime Text 2 Package directory.

$ git clone git://github.com/wesf90/rails-partial.git Rails Partial

Further instructions below.

Windows XP, 7 and 8

Execute the commands below one by one in your Command prompt.

$ cd "%APPDATA%\Sublime Text 2\Packages"
$ git clone git://github.com/wesf90/rails-partial.git "Rails Partial"

Linux

Execute the commands below one by one in your terminal.

$ cd ~/.config/sublime-text-2/Packages/
$ git clone git://github.com/wesf90/rails-partial.git Rails\ Partial

rails-partial's People

Contributors

wesf90 avatar alex-ross avatar sergio101 avatar

Watchers

 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.