Sha256: feb48268a6e5b9a056cd75ea19367ab3d2b3284c2cbd66ab0a7d50cbd7afaa94

Contents?: true

Size: 565 Bytes

Versions: 1

Compression:

Stored size: 565 Bytes

Contents

module Vue
  class MixinGenerator < Rails::Generators::NamedBase
    source_root File.expand_path('../templates', __FILE__)


    def generate_mixin
      template 'Mixin.template', Rails.root.join("app", "javascript", "components", *path, "#{mixin_name}.js")
    end

    private
    def mixin_name
      file = name.split("/").last
      if file.downcase.ends_with?(".js") || file.downcase.ends_with?(".vue")
        file = file.split(".")[0]
      end
      file
    end

    def path
      parts = name.split("/")
      parts.pop

      parts
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vue-generators-0.1.0 lib/vue/generators/vue/mixin/mixin_generator.rb