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

Different splitter output in development and prod #58

Closed
samisalami opened this issue Nov 17, 2015 · 9 comments
Closed

Different splitter output in development and prod #58

samisalami opened this issue Nov 17, 2015 · 9 comments

Comments

@samisalami
Copy link

Hey there :-)

First of all: Thanks for this gem! I could not believe, that there are actually no solutions for rails assets regarding the selector limitation in IE, except for your gem.
A small thing: To get the gem running we had to implement the helper method manually in our application helper to be available.

But now to the real problem:
In our local environment the splitter works like a charm and splits correctly. But on production the extraction starts with later rules which leads to missing rules on production for internet explorer.
I have no idea what the reason could be and I am hoping to get some input.

My first and only idea was that the compression on production might mess up the regular expressions, so I activated compression for development, but the splitting still worked like a charm.
Of cause it could be a problem with our project setup and not the gem itself, but I am really clueless where I could check and try...so I would appreciate any hint :-)

Thanks and Cheers from Hamburg ;-)

@jhilden
Copy link
Contributor

jhilden commented Nov 18, 2015

concerning the inclusion of the helper please take a look at #45 There it has been discussed what needs to be done, just waiting for somebody to champion this.

concerning your issue: I fear that, without any further details or preferrably a failing test case, nobody will be able to help out with your issue. Anything you can provide there is appreciated.

@samisalami
Copy link
Author

Hi Jakob :-)

Thanks for the answer and yeah I am really trying to. But I am not that experienced with ruby and rails and I am searching really just for hints where to start.

Today I disabled minifcation on production and now the output of the full css is almost the same on production and development (split 2 still smaller on production than on development):
2015-11-18_1329

Only difference is that on development the closing brace is not in the same line with the rules, beacause of the sass style -> expanded on develop and compressed on production. But this is the default and I tested the regex to strip comments on this and it just works fine with braces in the same line as the comments.

I will now test the regular expressions further with our css and I am hoping to find maybe something... because this only occurs on our production development I really have no idea how to debug this behaviour (debugging is completely disabled on the production environment and we do not have full access to it).

I am not expecting you do debug it for me or create a test case, I was just hoping that maybe you had already some ideas or experienced something similar.

I will update this issue, if I have anything new on it..

@samisalami
Copy link
Author

Due to the tight time table I had to switch to a manual solution with multiple SASS files for IE. Because we have variables, mixins, functions and virtual classes strictly seperated from real CSS output, its not a big deal, because these can be included in every single sass file without generating extra output. Of cause we still have one big file for all other browsers.
It's unfortunate I did not have the time to invest this further... but I might come back to this, if I am on a new project with ruby on rails. For now this issue can be closed.

@jhilden
Copy link
Contributor

jhilden commented Nov 19, 2015

@samisalami I could imagine that his issue has to do with what you are seeing: #57 There seems to be a bug with indentatin/whitespace in the reqular expression of the gem

@danielpuglisi
Copy link

Same issue here. If I compile application.css for production the _split2.css file misses selectors. No idea why though. Compressing hasn't anything to do with it.

@danielpuglisi
Copy link

Okay I managed to fix the output for me. Maybe someone can find out what's causing this because I don't have the time to dig into it right now.

I have a CSS file maps.sass which had some old comments at the end of the file:

.map-wrapper
  position: relative
  height: 480px
  overflow: hidden
  width: 100%
#map, .map
  position: absolute
  top: 0
  left: 0
  width: 100% !important
  height: 100% !important
  height: 480px

// .map-section
//   &.right, &.left
//     float: none !important

// @media #{$small-only}

//   .map-section-wrapper
//     padding-bottom: 0 !important

//   .map-section
//     position: relative
//     height: 300px
//     margin-top: 20px

// @media #{$medium-up}
//   .map-section-wrapper
//     position: relative

//   .map-section
//     position: absolute
//     top: 0
//     right: 0
//     height: 100%
//     width: 50%
//     margin-top: 0
//     &.right
//       right: 0
//     &.left
//       left: 0

After removing the comments the _split2.css files gets correctly compiled. The interesting part although is that removing only the first comment block (// .map-section ...) and leaving the commented media blocks also results in the correct output:

.map-wrapper
  position: relative
  height: 480px
  overflow: hidden
  width: 100%
#map, .map
  position: absolute
  top: 0
  left: 0
  width: 100% !important
  height: 100% !important
  height: 480px

// @media #{$small-only}

//   .map-section-wrapper
//     padding-bottom: 0 !important

//   .map-section
//     position: relative
//     height: 300px
//     margin-top: 20px

// @media #{$medium-up}
//   .map-section-wrapper
//     position: relative

//   .map-section
//     position: absolute
//     top: 0
//     right: 0
//     height: 100%
//     width: 50%
//     margin-top: 0
//     &.right
//       right: 0
//     &.left
//       left: 0

Maybe someone can dig into it and find out what's causing this.

@jhilden
Copy link
Contributor

jhilden commented Nov 24, 2015

@danielpuglisi that seems weird to me, because the commented part of Sass should just be removed completely by the compiler. a minimal test case with you code tha reproduces the error would be very helpful for somebody else to to dig into the issue.

@danielpuglisi
Copy link

@jhilden forget what I said in the last comment. I can't reproduce it myself now. It seems like removing commented lines randomly generates the correct output for me. No idea what's going on.

Removed all the comments and using the code from #57 seems to work. But I wouldn't bet on it. Will keep an eye on this.

@jhilden
Copy link
Contributor

jhilden commented Dec 11, 2015

Closing this since #57 has been merged and released

@jhilden jhilden closed this as completed Dec 11, 2015
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

3 participants