{"id":26502838,"url":"https://github.com/grassator/karma-generic-preprocessor","last_synced_at":"2025-03-20T18:35:44.714Z","repository":{"id":20980131,"uuid":"24269234","full_name":"grassator/karma-generic-preprocessor","owner":"grassator","description":"Provides a way to define preprocessors inline in the karma configuration files.","archived":false,"fork":false,"pushed_at":"2018-10-14T16:17:55.000Z","size":5,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-10T14:44:30.740Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/grassator.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-09-20T17:22:43.000Z","updated_at":"2021-11-05T18:19:06.000Z","dependencies_parsed_at":"2022-07-25T08:32:09.055Z","dependency_job_id":null,"html_url":"https://github.com/grassator/karma-generic-preprocessor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grassator%2Fkarma-generic-preprocessor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grassator%2Fkarma-generic-preprocessor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grassator%2Fkarma-generic-preprocessor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grassator%2Fkarma-generic-preprocessor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grassator","download_url":"https://codeload.github.com/grassator/karma-generic-preprocessor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244671890,"owners_count":20491271,"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":[],"created_at":"2025-03-20T18:35:44.246Z","updated_at":"2025-03-20T18:35:44.708Z","avatar_url":"https://github.com/grassator.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# karma-generic-preprocessor\n\nProvides a way to define preprocessors inline in the karma configuration\nfiles. This can be very handy in some situations, for example:\n\n  * URL rewriting\n  * using exotic JS / CSS preprocessors without having to write dedicated plugin\n  * whatever else you decide to do :)\n\n## Installation\n\n``` bash\nnpm install karma-generic-preprocessor --save\n```\n\n**Note:** Karma will automatically see and include plugins whose names start with `karma-*`. However, it is possible that, in your IDE or console configurations, you're running Karma as a global Node module. In that case, you'll have to install this plugin too globally, i.e\n\n``` bash\nnpm install karma-generic-preprocessor -g\n```\n\n## Configuration and Usage\n\n``` js\n// karma.conf.js\nmodule.exports = function(config) {\n  config.set({\n    preprocessors: {\n      // it's probably best to keep this as generic as possible\n      // since `karma-generic-preprocessor` has it's own matcher\n      '**/*': ['generic'] \n    },\n    genericPreprocessor: {\n      rules: [{\n        // this will always be matched on original path, even\n        // if you change file.path in of the `process` functions\n        match: \"*.coffee\",\n        // almost  same as karam-coffee-preprocessor\n        process: function (content, file, done, log) {\n          file.path = file.originalPath.replace(/\\.coffee$/g, '.js');\n          try {\n            done(coffee.compile(content));\n          } catch (e) {\n            log.error('%s\\n  at %s', e.message, file.originalPath);\n          }\n        }\n      }, {\n        // if no match is specified all the files matched by\n        // `preprocessors` config above will be processed\n        process: function (content, file, done, log) {\n          log.debug('Processing \"%s\".', file.originalPath);\n          done(content);\n        }\n      }]\n    }\n  })\n}\n```\n\n## LICENSE\n\nAvailable under MIT style license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrassator%2Fkarma-generic-preprocessor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrassator%2Fkarma-generic-preprocessor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrassator%2Fkarma-generic-preprocessor/lists"}