Set up stylelint
Used 27 times
T
TobiasBales
Usage
Run this command in your Rails app directory in the terminal:
rails app:template LOCATION="https://railsbytes.com/script/VD7sGv"
Template Source
Review the code before running this template on your machine.
if File.exists? ".stylelintrc.json"
puts ".stylelintrc.json already exists, aborting stylelint setup"
return
end
def yarn(*packages)
run("yarn add --dev #{packages.join(" ")}")
end
def file_contains(file, string)
File.foreach(file).detect { |line| line.include?(string) }
end
yarn 'stylelint', 'stylelint-config-standard'
create_file '.stylelintrc.json' do <<~JSON
{
"extends": "stylelint-config-standard"
}
JSON
end