gabiseabra / google-fonts-webpack-plugin

131 stars 44 forks source link

Consistent ordering of output. #6

Closed Danack closed 7 years ago

Danack commented 7 years ago

Hi,

Is it possible for the fonts CSS output file to be ordered consistently? If not, please consider this to be a feature request to allow that.

We store the built fonts.css file in source control to allow for easy testing of builds.

The problem I'm currently seeing is that the output seems to be ordered randomly. This means that even if the input settings for the fonts haven't changed, it seems that the built font.css file can change arbitrarily.

For the example diff below, on one build, Roboto was placed before Open Sans, and then in the next build Open Sans was placed before Roboto. This generates a large diff, when there is no real difference between the files.

Possibly ordering the output by the "Roboto - regular" string would be one solution to that.

cheers Dan

diff --git a/www/styles/fonts.css b/www/styles/fonts.css
index 40ecef7..4a9b45c 100644
--- a/www/styles/fonts.css
+++ b/www/styles/fonts.css
@@ -1,18 +1,3 @@
-/* === Roboto - regular */
-@font-face {
-   font-family: 'Roboto';
-   font-style: normal;
-   font-weight: 400;
-   src: url("./../font/Roboto-Regular.eot");
-   src: local("Roboto"),
-       local("Roboto-Regular"),
-       url("./../font/Roboto-Regular.eot") format("embedded-opentype"),
-       url("./../font/Roboto-Regular.woff") format("woff"),
-       url("./../font/Roboto-Regular.woff2") format("woff2"),
-       url("./../font/Roboto-Regular.ttf") format("truetype"),
-       url("./../font/Roboto-Regular.svg") format("svg");
-}
-
 /* === Open Sans - regular */
 @font-face {
    font-family: 'Open Sans';
@@ -27,3 +12,18 @@
        url("./../font/OpenSans-Regular.ttf") format("truetype"),
        url("./../font/OpenSans-Regular.svg") format("svg");
 }
+
+/* === Roboto - regular */
+@font-face {
+   font-family: 'Roboto';
+   font-style: normal;
+   font-weight: 400;
+   src: url("./../font/Roboto-Regular.eot");
+   src: local("Roboto"),
+       local("Roboto-Regular"),
+       url("./../font/Roboto-Regular.eot") format("embedded-opentype"),
+       url("./../font/Roboto-Regular.woff") format("woff"),
+       url("./../font/Roboto-Regular.woff2") format("woff2"),
+       url("./../font/Roboto-Regular.ttf") format("truetype"),
+       url("./../font/Roboto-Regular.svg") format("svg");
+}
Danack commented 7 years ago

\o/

Thanks.