{"id":22244062,"url":"https://github.com/agence-webup/gulpy","last_synced_at":"2025-03-25T11:10:21.879Z","repository":{"id":35038808,"uuid":"199463306","full_name":"agence-webup/gulpy","owner":"agence-webup","description":":rocket: A clean and concise Gulp API for common tasks","archived":false,"fork":false,"pushed_at":"2023-01-27T04:30:11.000Z","size":15217,"stargazers_count":2,"open_issues_count":11,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-14T04:55:25.386Z","etag":null,"topics":["elixir","frontend","gulp","workflow"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@agence-webup/gulpy","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/agence-webup.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":"2019-07-29T13:57:16.000Z","updated_at":"2024-03-24T23:18:48.000Z","dependencies_parsed_at":"2023-02-15T05:16:51.531Z","dependency_job_id":null,"html_url":"https://github.com/agence-webup/gulpy","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agence-webup%2Fgulpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agence-webup%2Fgulpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agence-webup%2Fgulpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agence-webup%2Fgulpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agence-webup","download_url":"https://codeload.github.com/agence-webup/gulpy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245449663,"owners_count":20617190,"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":["elixir","frontend","gulp","workflow"],"created_at":"2024-12-03T04:32:06.661Z","updated_at":"2025-03-25T11:10:21.847Z","avatar_url":"https://github.com/agence-webup.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gulpy\n\n## Install\n\n```shell\nnpm i -D @agence-webup/gulpy\n```\n\n## Example\n\nIn your gulpfile.js:\n\n```js\nconst gulp = require('gulp')\nconst Gulpy = require('@agence-webup/gulpy')\n\n// config\nconst gulpy = new Gulpy({\n  publicFolder: 'dist',\n  manifest: 'dist/rev-manifest.json',\n  npmManifest: 'dist/npm-manifest.json'\n})\n\n// tasks\nconst sass = gulpy.sass('src/sass/style.scss', 'dist/css') // this will automatically watch all .scss files in src/sass/**/*\nconst js = gulpy.js(['src/js/**/*', '!src/js/*.js'], 'dist/js')\nconst bundle = gulpy.bundle('src/js/*.js', 'dist/js', 'bundle.js')\nconst images = gulpy.images('src/img/**/*', 'dist/img')\nconst copyNpm = gulpy.copyNpm('dist/node_modules')\nconst version = gulpy.version(['dist/**', '!dist/node_modules/**', '!**/*.html'])\nconst npmVersion = gulpy.npmVersion()\nconst clean = gulpy.clean(['dist/**'])\nconst copy = gulp.parallel(\n  gulpy.copy('src/fonts/**/*', 'dist/fonts'),\n  gulpy.copy('src/**/*.html', 'dist')\n)\nconst replaceVersion = gulp.parallel(\n  gulpy.replaceVersion('dist/**/*.css', 'dist'),\n  gulpy.replaceVersion('dist/**/*.html', 'dist')\n)\n\n// export\nexports.default = gulp.series(clean, gulp.series(sass, js, bundle, images, copy, copyNpm))\nif (gulpy.isProduction()) {\n  exports.default = gulp.series(exports.default, version, replaceVersion, npmVersion)\n}\nexports.watch = gulpy.watch()\n\n\n```\n\n## Methods\n\n* `sass(src, dist)`\n* `less(src, dist)`\n* `js(src, dist)`\n* `bundle(src, dist, filename)`\n* `images(src, dist)`\n* `clean(dist)`\n* `copy(src, dist)`\n* `copyNpm(dist)`\n* `version(src)`\n* `replaceVersion(src, dist)` rewrite occurrences of filenames using the cache manifest in static files\n* `npmVersion()` generate a cache manifest for node_modules (useful for cache busting)\n* `watch()` auto watch all configured tasks\n* `clearCache()` clear the cache (mainly used for images)\n* `isProduction()` return true if the flag --production or --prod is used\n\n`src` and `dist`can be glob strings (https://gulpjs.com/docs/en/getting-started/explaining-globs)\n\n## Cache busting\n\nCache busting is an important process when you want to work with `Expires` header on the server side. Here are some explanations on how Gulpy handle this workflow:\n\n1. `gulpy.version()` appends a hash to filename by using [gulp-rev](https://github.com/sindresorhus/gulp-rev#readme) `image-1.jpg` → `image-1-7e44430a95.jpg`\n2. `gulpy.version()` also writes a cache manifest file (from the `manifest` option passed to Gulpy constructor)\n3. `gulpy.replaceVersion()` reads the cache manifest file and replaces occurrences of filenames in static files\n`body{background-image:url(img/image-1.jpg)}` → `body{background-image:url(img/image-1-7e44430a95.jpg)}`\n4. `gulp.npmVersion()` generates a cache manifest for node_modules\n\n## Local development\n\n```\n./node_modules/gulp/bin/gulp.js watch\n```\n\nYou can also use browsersync:\n\n```\n./node_modules/gulp/bin/gulp.js watch --proxy http://localhost:8000\n```\n\n## Production:\n\n```\n./node_modules/gulp/bin/gulp.js --production\n```\n\nIt will automatically handle production requirement (like files minification) and generate a manifest file for cache busting.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagence-webup%2Fgulpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagence-webup%2Fgulpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagence-webup%2Fgulpy/lists"}