Comments (5)
How would this be a breaking change? The way the CSS files are generated in relation to where the font files are located is incorrect and broken. CSS url paths are relative to the location of the CSS file.
from gulp-google-webfonts.
No, this would be a breaking change. Feel free to send a PR, including an extra boolean parameter to enable such behaviour.
from gulp-google-webfonts.
Current users expect the current behaviour. Hence changing it would be a breaking change.
from gulp-google-webfonts.
Hi there 👋,
First of all thank you for your time and effort that goes into this package.
Any news on this request? If someone were to point me in the right direction I'd love to create a PR and add this, if I am capable of doing so.
My Gulp task:
gulp.task('google', function () {
return gulp.src('./fonts.list')
.pipe(plugins.googleWebfonts({
fontsDir: 'fonts',
cssDir: 'scss/fonts',
cssFilename: '_google.scss'
}))
.pipe(gulp.dest('./assets'));
});
Directory structure
- assets
-- dist
-- fonts
-- img
-- js
-- scss
As you can see, I'm storing the downloaded fonts in assets/fonts
, the CSS (which I rename to use SCSS) in assets/scss/fonts
and rename the file _google.scss
. After all is said and done, my dist
folder looks like:
- dist
-- css
-- fonts
-- img
-- js
This is the reason I need to make the following change(s):
Before changes
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: url(fonts/Roboto-normal-500.woff) format('woff');
unicode-range: U+0-10FFFF;
}
@font-face {
font-family: 'Roboto';
font-style: italic;
font-weight: 500;
src: url(fonts/Roboto-italic-500.woff) format('woff');
unicode-range: U+0-10FFFF;
}
After changes
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: url(../fonts/Roboto-normal-500.woff) format('woff');
unicode-range: U+0-10FFFF;
}
@font-face {
font-family: 'Roboto';
font-style: italic;
font-weight: 500;
src: url(../fonts/Roboto-italic-500.woff) format('woff');
unicode-range: U+0-10FFFF;
}
Note the ../
in the src
.
from gulp-google-webfonts.
Either a boolean parameter could be added, indicating (when set) that the font paths should be relative to CSS paths, or an optional string parameter could be added, containing a prefix to be prepended to font paths.
The code isn't commented particularly well. but it's quite short so you may be able to add this without much effort after giving the code a quick read.
from gulp-google-webfonts.
Related Issues (20)
- support fonts.list as string and not only from file HOT 1
- Support for SVG and EOT formats HOT 3
- &subset=cyrillic wrong font download
- Missing local src HOT 1
- Support for generate css with woff and woff2 fonts HOT 1
- How to set path for fonts in generated CSS? HOT 1
- woff2? HOT 4
- version without gulp? HOT 1
- HTTPS support HOT 3
- Set site root as font url HOT 1
- build fonts.list for gulp-google-webfonts HOT 1
- Error: connect ECONNREFUSED 127.0.0.1:443 (Oswald font only) HOT 4
- Process multiple font formats HOT 1
- New npm package for v3
- Attribute font-stretch doesn't match the regex HOT 1
- Example gulpfile.js's outdated
- "Google Format" wrong
- Alternative path to fonts for @font-face rules
- Fonts dir with starting slash
- Option to pass string instead of a file name
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gulp-google-webfonts.