Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HotReload doesn't work with sass plugin #37

Closed
alexisvincent opened this issue Dec 27, 2015 · 3 comments
Closed

HotReload doesn't work with sass plugin #37

alexisvincent opened this issue Dec 27, 2015 · 3 comments

Comments

@alexisvincent
Copy link
Owner

As far as I can see, the sass import tree isnt recognosed by systems module loading scheme as this is specific to sass. As such editing a child .scss file doesnt update the root. It might be a good idea for plugins to offer a hotReload hook so as to allow each plugin to handle its own hot reload logic, instead of adding something custom to the hot-reloader core.

Sass/css hot reloading is important, especially if this is going to integrated to the jspm core. @guybedford

@alexisvincent
Copy link
Owner Author

A hacky fix is to detect .scss and then manually delete the root .scss and reload it.

hotReload (moduleName) {
    const self = this
    const start = new Date().getTime()

        if (moduleName.endsWith('.scss')) {
            var rootSCSS = 'app/web/app.scss!';
            return System.normalize(rootSCSS).then(function(normalizedName){
                System.delete(normalizedName)
                return System.import(rootSCSS)
            })
        }

    this.modulesJustDeleted = {}  // TODO use weakmap
    //etc...

@guybedford
Copy link
Collaborator

The way I expected to handle this was for the plugin itself to provide the hot reload hooks for the dummy module representing each sass file. But let me know if that approach doesn't work out?

@alexisvincent
Copy link
Owner Author

That should work. You would need to do an interception, similar to how I'm doing it here, as chakara will send over all the paths. This would need to be supported by jspm though. Its not something that can be neatly added by a user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants