BrianSipple / ember-cli-svgstore

Ember addon to combine SVGs as symbols in a spritesheet.
MIT License
20 stars 8 forks source link

The addon seems to break built-in CSS hot reloading #4

Closed voltidev closed 8 years ago

voltidev commented 8 years ago

As you might know, ember-cli has a built-in styles hot reloading feature. So when you change your SCSS/CSS files, only styles will be reloaded and your app will keep the same state in the browser.

But if I add ember-cli-svgstore to the package.json, the hot reloading feature doesn't work at all, so any changes in style files will force the whole browser tab to reload.

dfreeman commented 8 years ago

I'm unable to reproduce this just by dropping ember-cli-svgstore into a vanilla Ember app. Can you provide more information about your setup? CLI version, any extra configuration for this addon, etc. would be super helpful in trying to track this down.

voltidev commented 8 years ago

I use Ember CLI v2.5.0 Here you can see my app, including package.json: [https://github.com/ivanvotti/time-tracker]()

voltidev commented 8 years ago

I've just made a new ember app and could reproduce the problem.

  1. I added ember-cli-svgstore to package.json
  2. I added the code below to the ember-cli-build.js file:
  var app = new EmberApp(defaults, {
    svgstore: {
      files: {
        sourceDirs: 'icons',
        outputFile: '/assets/icons.svg'
      }
    }
  });
dfreeman commented 8 years ago

Aha, I see. This looks like an issue upstream in broccoli-svgstore – it doesn't cache its output, so the entire app tree gets invalidated each time there's a rebuild.

I'm not likely to have a chance to get to this in the near future (we're not actually using this addon internally at the moment), but fixing this should just be a matter of swapping in broccoli-caching-writer as the base class for that plugin.

jesseditson commented 8 years ago

Added an issue (above), and a PR to fix the issue (https://github.com/svgstore/broccoli-svgstore/pull/12) to the broccoli-svgstore repo.

BrianSipple commented 8 years ago

broccoli-svgstore 0.2.0 has just been released -- giving it a much-needed update after almost 2 years 😄. It builds on top of broccoli-caching-writer, so I'm thinking it should resolve this issue.