Sha256: 831b9786750ea2b449a92733f2f225b56afef8722396bc4bddc2be868f96c823

Contents?: true

Size: 561 Bytes

Versions: 3

Compression:

Stored size: 561 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", "mixins", *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

3 entries across 3 versions & 1 rubygems

Version Path
vue-generators-0.1.3 lib/vue/generators/vue/mixin/mixin_generator.rb
vue-generators-0.1.2 lib/vue/generators/vue/mixin/mixin_generator.rb
vue-generators-0.1.1 lib/vue/generators/vue/mixin/mixin_generator.rb