Skip to content
This repository was archived by the owner on Oct 9, 2020. It is now read-only.

Check for DOM in CSSPluginBase.prototype.instantiate()#113

Merged
guybedford merged 1 commit intosystemjs:masterfrom
mikol-styra:mikol-check-for-dom
Oct 20, 2016
Merged

Check for DOM in CSSPluginBase.prototype.instantiate()#113
guybedford merged 1 commit intosystemjs:masterfrom
mikol-styra:mikol-check-for-dom

Conversation

@mikol-styra
Copy link

@mikol-styra mikol-styra commented Oct 18, 2016

Fixes #111

return _retrieveGlobal();
});
(function(c){if (typeof document == 'undefined') return; var d=document,a='appendChild',i='styleSheet',s=d.createElement('style');s.type='text/css';d.getElementsByTagName('head')[0][a](s);s[a](d.createTextNode(c));})
("@import \"./dep.css\";body{background-color:red;background-image:url(test/data/x.png)}\n/*# sourceMappingURL=__.css.map */"); No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this is a breaking change unfortunately!

We do still need to output CSS for builds :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm… I am monkey patching CSSPluginBase in my environment and it builds just fine. I wonder what the difference is?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be that plugin-less currently depends on plugin-css 0.1.30 and plugin-css itself is at 0.1.31.

Maybe the fix needs to be at the plugin-less level.

@guybedford
Copy link
Member

Let me know if you have any ideas moving forward here. Otherwise I'll get to it when I get to it.

@mikol-styra mikol-styra reopened this Oct 19, 2016
@mikol-styra
Copy link
Author

Wait. One thing that might be happening is that the test is generating a bundle.css file… Not sure why that isn’t checked in, etc. But the CSS is being built.

@mikol-styra
Copy link
Author

So I think that this change is not breaking. The following test overwrites test/bundle.js, which is what I included in this PR.

it('Should support separateCSS: true and sourceMaps: false', function() {

If I skip this test (with xit), then I think bundle.js comes out as expected. Namely:

System.registerDynamic("test/data/test.css!css.js", [], false, function ($__require, $__exports, $__module) {
  var _retrieveGlobal = System.get("@@global-helpers").prepareGlobal($__module.id, null, null);

  (function ($__global) {})(this);

  return _retrieveGlobal();
});
(function(c){if (typeof document == 'undefined') return; var d=document,a='appendChild',i='styleSheet',s=d.createElement('style');s.type='text/css';d.getElementsByTagName('head')[0][a](s);s[a](d.createTextNode(c));})
("@import \"./dep.css\";body{background-color:red;background-image:url(test/data/x.png)}\n/*# sourceMappingURL=__.css.map */");

I’m not sure why bundle.js is checked in to begin with. But perhaps the tests should be updated to generate a separate bundle rather than overwriting the one file.

Let me know how you want to proceed, and I will update my PR accordingly.

Thanks!

@guybedford
Copy link
Member

Ahh thanks, sorry yes I hadn't updated those files here.

Ok, looks great to me! Thanks again.

@guybedford guybedford merged commit 1a3f442 into systemjs:master Oct 20, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants