github.com/ashleymcnamara/buffalo@v0.8.0/buffalo/cmd/generate/webpack.go (about)

     1  package generate
     2  
     3  import (
     4  	"github.com/gobuffalo/buffalo/generators/assets/webpack"
     5  	"github.com/gobuffalo/makr"
     6  	"github.com/spf13/cobra"
     7  )
     8  
     9  var withYarn bool
    10  
    11  // WebpackCmd generates a new actions/resource file and a stub test.
    12  var WebpackCmd = &cobra.Command{
    13  	Use:   "webpack [flags]",
    14  	Short: "Generates a webpack asset pipeline.",
    15  	RunE: func(cmd *cobra.Command, args []string) error {
    16  		data := makr.Data{
    17  			"withWebpack": true,
    18  			"withYarn":    withYarn,
    19  		}
    20  		wg, err := webpack.New(data)
    21  		if err != nil {
    22  			return err
    23  		}
    24  		return wg.Run(".", data)
    25  	},
    26  }
    27  
    28  func init() {
    29  	WebpackCmd.Flags().BoolVar(&withYarn, "with-yarn", false, "allows the use of yarn instead of npm as dependency manager")
    30  }