wilr / grunt-shopify

Grunt plug-in for publishing Shopify theme assets
BSD 3-Clause "New" or "Revised" License
107 stars 32 forks source link

No support for multiple shops #19

Closed reggi closed 10 years ago

reggi commented 11 years ago

I changed "options" to one shop name and put two objects in in. I was getting:

Fatal error: Cannot read property 'disable_growl_notifications' of undefined

Realized you cant change the properties of "shopify" task.

wilr commented 11 years ago

So you would like to push the same code to 2 different shops? Seems like a bit of an edge case and I personally wouldn't need it so PR welcome if you want to contribute the feature.

reggi commented 11 years ago

I'd love to set up production and development tasks. Unfortunately I can't get both sets of keys in there.

pagameba commented 10 years ago

This can easily be achieved by using env variables, I use it like this:

grunt.initConfig({
  pkg: grunt.file.readJSON('package.json'),
  shopify: {
    options: {
      api_key: process.env.SHOPIFY_API_KEY,
      password: process.env.SHOPIFY_API_PASSWORD,
      url: process.env.SHOPIFY_API_URL,
      base: 'theme/'
    }
  },
  watch: {
    shopify: {
      files: ['theme/assets/**','theme/config/**','theme/layout/**','theme/snippets/**','theme/templates/**']
    }
  }
});

then invoke grunt like this:

SHOPIFY_API_KEY=<key> SHOPIFY_API_PASSWORD=<password> SHOPIFY_API_URL=<url> grunt shopify

It is easy to switch between stores this way.

wilr commented 10 years ago

As @pagameba has described (and as readme says) ENV variables are the way to go for managing configuration. You can also implement your own shortcuts for push prod, push dev if you need outside of the context of the plugin