Skip to content

Commit

Permalink
Add InstallStylelintGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
stgeneral committed May 3, 2019
1 parent 1c357d0 commit 6495998
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ rails generate auxiliary_rails:install_errors
rails generate auxiliary_rails:install_eslint
rails generate auxiliary_rails:install_rubocop
rails generate auxiliary_rails:install_rubocop --no-specify-gems
rails generate auxiliary_rails:install_stylelint
```

### View Helpers
Expand Down
28 changes: 28 additions & 0 deletions lib/generators/auxiliary_rails/install_stylelint_generator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
require 'rails'

module AuxiliaryRails
class InstallStylelintGenerator < ::Rails::Generators::Base
PACKAGES = %w[
stylelint
stylelint-config-standard
].freeze

source_root File.expand_path('templates/stylelint', __dir__)

def copy_config_files
copy_file 'stylelintrc_template.yml',
'.stylelintrc.yml'
end

def install_stylelint_packages
run 'yarn add -D ' + PACKAGES.join(' ')
end

def show_instructions
say %(
Run `stylelint` using this command:
=> yarn run stylelint app/assets/stylesheets/
)
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extends: "stylelint-config-standard"

0 comments on commit 6495998

Please sign in to comment.