{"id":13447286,"url":"https://github.com/unlight/gulp-cssimport","last_synced_at":"2025-04-10T22:31:38.058Z","repository":{"id":14009269,"uuid":"16710760","full_name":"unlight/gulp-cssimport","owner":"unlight","description":"Parses a CSS file, finds imports, grabs the content of the linked file and replaces the import statement with it.","archived":false,"fork":false,"pushed_at":"2019-09-02T13:02:36.000Z","size":103,"stargazers_count":35,"open_issues_count":2,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-25T05:41:36.341Z","etag":null,"topics":["gulp-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unlight.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-10T21:56:54.000Z","updated_at":"2023-09-20T09:23:59.000Z","dependencies_parsed_at":"2022-09-16T18:51:27.464Z","dependency_job_id":null,"html_url":"https://github.com/unlight/gulp-cssimport","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Fgulp-cssimport","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Fgulp-cssimport/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Fgulp-cssimport/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Fgulp-cssimport/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unlight","download_url":"https://codeload.github.com/unlight/gulp-cssimport/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248157885,"owners_count":21057085,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gulp-plugin"],"created_at":"2024-07-31T05:01:12.968Z","updated_at":"2025-04-10T22:31:37.353Z","avatar_url":"https://github.com/unlight.png","language":"JavaScript","readme":"# gulp-cssimport\nParses a CSS file, finds imports, grabs the content of the linked file and replaces the import statement with it.\n\n## INSTALL\n```sh\nnpm install gulp-cssimport\n```\n\n## USAGE\n```js\nvar gulp = require(\"gulp\");\nvar cssimport = require(\"gulp-cssimport\");\nvar options = {};\ngulp.task(\"import\", function() {\n\tgulp.src(\"src/style.css\")\n\t\t.pipe(cssimport(options))\n\t\t.pipe(gulp.dest(\"dist/\"));\n}); \n```\n\n## OPTIONS\n#### includePaths\nArray, default: `[]`  \nAdditional paths to resolve imports.\n\n#### skipComments\nBoolean, default: `true`  \ngulp-cssimport plugin uses regular expressions which is fast but not solid as AST.\nIf you have any unexpected result, missing imported content, etc. Try to disable this option.\n\n#### filter\nRegExp, default: `null` (no filter).  \nProcess only files which match to regexp.\nAny other non-matched lines will be leaved as is.  \nExample:\n```js\nvar options = {\n\tfilter: /^http:\\/\\//gi // process only http urls\n};\n```\n\n#### matchPattern  \nString, glob pattern string. See [minimatch](https://www.npmjs.com/package/minimatch) for more details.\n```js\nvar options = {\n\tmatchPattern: \"*.css\" // process only css\n};\nvar options2 = {\n\tmatchPattern: \"!*.{less,sass}\" // all except less and sass\n};\n```\n**Note:**\n`matchPattern` will not be applied to urls (remote files, e.g. `http://fonts.googleapis.com/css?family=Tangerine`), only files.  \nUrls are matched by default. If you do not want include them, use `filter` option (it is applicable to all).\n\n#### matchOptions\nObject, [minimatch](https://www.npmjs.com/package/minimatch) options for `matchPattern`.\n\n#### limit\nNumber, default `5000`.  \nDefence from infinite recursive import.\n\n#### transform\nFunction, default `null`  \nTransform function applied for each import path.  \nSignature:\n```\n(path: string, data: {match: string}) =\u003e string\n```\nArguments:\n* `path` - string, path in import statement\n* object with data:\n  - `match` - string, matched import expression\n\n#### extensions  \nDeprecated, use `matchPattern` instead.  \nString or Array, default: `null` (process all).\nCase insensitive list of extension allowed to process.\nAny other non-matched lines will be leaved as is.  \nExamples:\n```js\nvar options = {\n\textensions: [\"css\"] // process only css\n};\nvar options = {\n\textensions: [\"!less\", \"!sass\"] // all except less and sass\n};\n```\n\n## TIPS AND TRICKS\n**Be more precise and do not add to src importing file without necessary:**  \n```css\n// main.css\n@import \"a.css\";\n@import \"b.css\";\n```\nIf you will do `gulp.src(\"*.css\")` gulp will read `a.css` and `b.css`,\nand plugin also will try to read these files. It is extra job.  \nDo instead: `gulp.src(\"main.css\")`\n\n**Use filter option:**  \nIf you need exclude files from import, try use `filter` only option (it is faster) and avoid others.\n\n\n## POSTCSS\nThere are plugins for [PostCSS](https://github.com/postcss/postcss) which do same job or even better:\n* [postcss-import](https://github.com/postcss/postcss-import) inlines the stylesheets referred to by `@import` rules\n* [postcss-import-url](https://github.com/unlight/postcss-import-url) inlines remote files.\n\n\n## SIMILAR PROJECTS\nhttps://npmjs.org/package/gulp-coimport/  \nhttps://npmjs.org/package/gulp-concat-css/  \nhttps://github.com/yuguo/gulp-import-css/  \nhttps://github.com/postcss/postcss-import  \nhttps://www.npmjs.com/package/combine-css/  \nhttps://github.com/suisho/gulp-cssjoin  \nhttps://github.com/jfromaniello/css-import  \nhttps://github.com/mariocasciaro/gulp-concat-css  \n\n\n## KNOWN ISSUES\n- Cannot resolve `@import 'foo.css' (min-width: 25em);`\n\n## TODO\n- Cache\n\n## CHANGELOG\nSee [CHANGELOG](CHANGELOG.md)\n\n## Support\n\n[![Beerpay](https://beerpay.io/unlight/gulp-cssimport/badge.svg?style=beer-square)](https://beerpay.io/unlight/gulp-cssimport) [![Beerpay](https://beerpay.io/unlight/gulp-cssimport/make-wish.svg?style=flat-square)](https://beerpay.io/unlight/gulp-cssimport?focus=wish)\n","funding_links":[],"categories":["JavaScript","插件","Plugins"],"sub_categories":["其他插件","Miscellaneous Plugins"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funlight%2Fgulp-cssimport","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funlight%2Fgulp-cssimport","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funlight%2Fgulp-cssimport/lists"}