Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • David Amri 214 posts 740 karma points
    May 03, 2017 @ 07:15
    David Amri
    0

    Strange behavior when bundeling and minifying css with ClientDependency

    When bundeling and minifying multiple css files with ClientDependency the bundled file contains multiple @charset "UTF-8"; spread out the document.

    The css files are compiled from scss files. When compiling the scss files a @charset "UTF-8" is automatically added to each generated css file at the beginning of the file. Then when bundled the file looks something like this:

    @charset "UTF-8"; css code from css file 1... @charset "UTF-8"; css code from css file 2... @charset "UTF-8"; css code from css file 3...

    This will result in a invalid css file, any thoughts?

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    May 03, 2017 @ 08:33
    Dave Woestenborghs
    0

    Hi David,

    Maybe it's a option to let sass bundle all your files in to one css ? You can then use ClientDependency to minify this.

    Dave

  • David Amri 214 posts 740 karma points
    May 04, 2017 @ 11:17
    David Amri
    0

    Hi Dave,

    This is really strange. Now I tried to compile all of my sass files into one single css file. Then using ClientDependency to bundle and minify this single css file. Now the charset UTF-8 is added once at the top as expected but strangely my google font @import is duplicated like this:

    @import font... (this is not expected)

    @charset... (this is expected)

    @import font... (this is expected)

    Css styles...

    If I remove my single google font @import from my sass file the final bundled and minified css file will as expected not print out any font @import.

    This is happening only when debug is set to false, when debug is set to true the file looks as expected with @charset, @import font and the css code below.

    Of course I could fetch the google font with the "link" tag, but I'm curious if I'm the only one having lots of issues with the bundling and minifying.

    Also, it makes me kind of sad that I'm not able to use "view specific" css files since I'm not able to bundle multiple css files due to the charset UTF-8 issue. I't would be extremely nice not to have one large css file, especially when there is no use of some of the css on certain pages.

    / David

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

    Continue discussion

Please Sign in or register to post replies