Sha256: 03ba1a65f672a1a431e51bc23ff37c90c5b391e1eaccb92b531f1aa62ff4f0fe
Contents?: true
Size: 1.8 KB
Versions: 1
Compression:
Stored size: 1.8 KB
Contents
# frozen_string_literal: true require "rails/generators" class SnowpackerGenerator < ::Rails::Generators::Base TEMPLATES = File.join(File.expand_path(__dir__), "templates") desc "Generate Snowpacker initializer" def create_initializer_file initializer "snowpacker.rb" do File.read(File.join(TEMPLATES, "snowpacker.rb")) end end desc "Add snowpack, babel, and postcss to your package.json dependencies" def add_snowpack %x(yarn add -D snowpack \ @snowpack/babel-plugin-package-import \ core-js@3 \ postcss \ postcss-cli \ postcss-import \ postcss-flexbugs-fixes \ postcss-preset-env \ @babel/core \ @babel/cli \ @babel/preset-env \ @babel/plugin-transform-runtime \ babel-plugin-macros \ @snowpack/plugin-babel \ @babel/preset-env \ babel-plugin-macros \ @babel/plugin-syntax-dynamic-import \ babel-plugin-dynamic-import-node \ @babel/plugin-transform-destructuring \ @babel/plugin-proposal-class-properties \ @babel/plugin-proposal-object-rest-spread \ @babel/plugin-transform-runtime \ @babel/plugin-transform-regenerator ) end desc "Create config files IE: babel.config snowpack.config" def create_config_files config_files = %w[ snowpack.config.js postcss.config.js babel.config.js .browserslistrc ] config_files.each do |filename| create_file Rails.root.join("config", "snowpacker", filename) do File.read(File.join(TEMPLATES, filename)) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
snowpacker-0.0.4.alpha1 | lib/snowpacker/snowpacker_generator.rb |