diff --git a/.gitignore b/.gitignore index 1514a71..49824f4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /node_modules/ example*/out/ +example*/node_modules .*.swp .*.swo package-lock.json diff --git a/example5/fonts.list b/example5/fonts.list new file mode 100644 index 0000000..1c4301c --- /dev/null +++ b/example5/fonts.list @@ -0,0 +1 @@ +Open+Sans:300&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext diff --git a/example5/gulpfile.js b/example5/gulpfile.js new file mode 100644 index 0000000..94b94d1 --- /dev/null +++ b/example5/gulpfile.js @@ -0,0 +1,13 @@ +var gulp = require('gulp'); +var googleWebFonts = require('../'); + +var options = { }; + +gulp.task('fonts', function () { + return gulp.src('./fonts.list') + .pipe(googleWebFonts(options)) + .pipe(gulp.dest('out/fonts')) + ; + }); + +gulp.task('default', ['fonts']); diff --git a/example5/package.json b/example5/package.json new file mode 100644 index 0000000..ebe2020 --- /dev/null +++ b/example5/package.json @@ -0,0 +1,11 @@ +{ + "name": "example5", + "version": "0.0.1", + "description": "", + "main": "gulpfile.js", + "scripts": { + "test": "gulp" + }, + "author": "Tingyu Huang", + "license": "ISC" +} diff --git a/index.js b/index.js index 95f2391..415b2a1 100755 --- a/index.js +++ b/index.js @@ -236,17 +236,22 @@ function getter(options) { // since Google doesn't put there '.svg' suffix for some reason // (but does that for other extensions). var re = new RegExp([ - "\\s*font-family:\\s*'([^']+)';", - "\\s*font-style:\\s*(\\w+);", - "\\s*font-weight:\\s*(\\w+);", - "\\s*src:([^;]*);", - ".*(?:unicode-range:([^;]+);)?", + "\\s*font-family:\\s*'(?[^']+)';", + "\\s*font-style:\\s*(?