manish143143 / cssmin

Automatically exported from code.google.com/p/cssmin
0 stars 0 forks source link

minification strips @font-face{src:url....... #77

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What version of CssMin are you using (source and/or build)?
3.0.1

What was the input stylesheet and/or configuration options?
Added the input stylesheet as attachment: fa.min.css

What is the expected result?
That 
"src:url('./font/fontawesome-webfont.eot?v=4.0.0');src:url('./font/fontawesome-w
ebfont.eot?#iefix&v=4.0.0') format('embedded-opentype')" remains

And what is the actual result and/or error message?
It's gone

Please provide any additional information below.
fa-min.css is the input file and fa.min.min.css is the output file.

i used an already minified css file, to make the difference more clear.

Original issue reported on code.google.com by s.weiguny on 27 Feb 2014 at 11:30

Attachments:

GoogleCodeExporter commented 9 years ago
I have the same issue.

Input:

@font-face {
  font-family: 'Glyphicons Halflings';
  src: url(if($bootstrap-sass-asset-helper, twbs-font-path('#{$icon-font-path}#{$icon-font-name}.eot'), '#{$icon-font-path}#{$icon-font-name}.eot'));
  src: url(if($bootstrap-sass-asset-helper, twbs-font-path('#{$icon-font-path}#{$icon-font-name}.eot?#iefix'), '#{$icon-font-path}#{$icon-font-name}.eot?#iefix')) format('embedded-opentype'),
       url(if($bootstrap-sass-asset-helper, twbs-font-path('#{$icon-font-path}#{$icon-font-name}.woff'), '#{$icon-font-path}#{$icon-font-name}.woff')) format('woff'),
       url(if($bootstrap-sass-asset-helper, twbs-font-path('#{$icon-font-path}#{$icon-font-name}.ttf'), '#{$icon-font-path}#{$icon-font-name}.ttf')) format('truetype'),
       url(if($bootstrap-sass-asset-helper, twbs-font-path('#{$icon-font-path}#{$icon-font-name}.svg##{$icon-font-svg-id}'), '#{$icon-font-path}#{$icon-font-name}.svg##{$icon-font-svg-id}')) format('svg');
}

.glyphicon {
  position: relative;
  top: 1px;
  display: inline-block;
  font-family: 'Glyphicons Halflings';
  font-style: normal;
  font-weight: normal;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

Output using cssmin 3.0.1:

@font-face{position:relative;top:1px;display:inline-block;font-family:'Glyphicon
s 
Halflings';font-style:normal;font-weight:normal;line-height:1;-webkit-font-smoot
hing:antialiased;-moz-osx-font-smoothing:grayscale;}

Original comment by towang...@gmail.com on 28 Jan 2015 at 2:40

GoogleCodeExporter commented 9 years ago
**SOLVED**
----------

I have the same problem,
and i solved it by just adding a space after @font-face

$css = file_get_contents(/*whatever*/);
$css = str_replace('@font-face', '@font-face ', $css);
$minified = CssMin::minify(css);

Original comment by ahmed.s....@gmail.com on 29 Mar 2015 at 2:23