{"id":15823027,"url":"https://github.com/lelouchb/sapper-cloudinary-upload","last_synced_at":"2025-08-08T10:32:01.518Z","repository":{"id":42492597,"uuid":"368065936","full_name":"lelouchB/sapper-cloudinary-upload","owner":"lelouchB","description":"Upload Images to Cloudinary with Sapper.","archived":false,"fork":false,"pushed_at":"2022-04-03T04:02:10.000Z","size":287,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-12T08:25:19.092Z","etag":null,"topics":["cloudinary","cloudinary-api","image-upload","sapper","sapper-app","svelte"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lelouchB.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-17T05:29:10.000Z","updated_at":"2022-05-10T06:42:28.000Z","dependencies_parsed_at":"2022-09-14T17:53:23.197Z","dependency_job_id":null,"html_url":"https://github.com/lelouchB/sapper-cloudinary-upload","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/lelouchB%2Fsapper-cloudinary-upload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lelouchB%2Fsapper-cloudinary-upload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lelouchB%2Fsapper-cloudinary-upload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lelouchB%2Fsapper-cloudinary-upload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lelouchB","download_url":"https://codeload.github.com/lelouchB/sapper-cloudinary-upload/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229126205,"owners_count":18024020,"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":["cloudinary","cloudinary-api","image-upload","sapper","sapper-app","svelte"],"created_at":"2024-10-05T08:02:30.236Z","updated_at":"2024-12-10T20:07:10.783Z","avatar_url":"https://github.com/lelouchB.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sapper-cloudinary-upload\n\nUpload Images to Cloudinary with Sapper. \n![Screenshot_2021-05-17 Sapper Cloudinary Upload](https://user-images.githubusercontent.com/45850882/118437316-06fc1980-b700-11eb-91bd-7a1430f83c49.png)\n \n\n## Getting started\n\n\n### Using `degit`\n\nTo create a new Sapper project based on Rollup locally, run\n\n```bash\nnpx degit \"sveltejs/sapper-template#rollup\" my-app\n```\n\nFor a webpack-based project, instead run\n\n```bash\nnpx degit \"sveltejs/sapper-template#webpack\" my-app\n```\n\n[`degit`](https://github.com/Rich-Harris/degit) is a scaffolding tool that lets you create a directory from a branch in a repository.\n\nReplace `my-app` with the path where you wish to create the project.\n\n\n### Using GitHub templates\n\nAlternatively, you can create the new project as a GitHub repository using GitHub's template feature.\n\nGo to either [sapper-template-rollup](https://github.com/sveltejs/sapper-template-rollup) or [sapper-template-webpack](https://github.com/sveltejs/sapper-template-webpack) and click on \"Use this template\" to create a new project repository initialized by the template.\n\n\n### Running the project\n\nOnce you have created the project, install dependencies and run the project in development mode:\n\n```bash\ncd my-app\nnpm install # or yarn\nnpm run dev\n```\n\nThis will start the development server on [localhost:3000](http://localhost:3000). Open it and click around.\n\nYou now have a fully functional Sapper project! To get started developing, consult [sapper.svelte.dev](https://sapper.svelte.dev).\n\n### Using TypeScript\n\nBy default, the template uses plain JavaScript. If you wish to use TypeScript instead, you need some changes to the project:\n\n * Add `typescript` as well as typings as dependences in `package.json`\n * Configure the bundler to use [`svelte-preprocess`](https://github.com/sveltejs/svelte-preprocess) and transpile the TypeScript code.\n * Add a `tsconfig.json` file\n * Update the project code to TypeScript\n\nThe template comes with a script that will perform these changes for you by running\n\n```bash\nnode scripts/setupTypeScript.js\n```\n\n`@sapper` dependencies are resolved through `src/node_modules/@sapper`, which is created during the build. You therefore need to run or build the project once to avoid warnings about missing dependencies.\n\nThe script does not support webpack at the moment.\n\n## Directory structure\n\nSapper expects to find two directories in the root of your project —  `src` and `static`.\n\n\n### src\n\nThe [src](src) directory contains the entry points for your app — `client.js`, `server.js` and (optionally) a `service-worker.js` — along with a `template.html` file and a `routes` directory.\n\n\n#### src/routes\n\nThis is the heart of your Sapper app. There are two kinds of routes — *pages*, and *server routes*.\n\n**Pages** are Svelte components written in `.svelte` files. When a user first visits the application, they will be served a server-rendered version of the route in question, plus some JavaScript that 'hydrates' the page and initialises a client-side router. From that point forward, navigating to other pages is handled entirely on the client for a fast, app-like feel. (Sapper will preload and cache the code for these subsequent pages, so that navigation is instantaneous.)\n\n**Server routes** are modules written in `.js` files, that export functions corresponding to HTTP methods. Each function receives Express `request` and `response` objects as arguments, plus a `next` function. This is useful for creating a JSON API, for example.\n\nThere are three simple rules for naming the files that define your routes:\n\n* A file called `src/routes/about.svelte` corresponds to the `/about` route. A file called `src/routes/blog/[slug].svelte` corresponds to the `/blog/:slug` route, in which case `params.slug` is available to the route\n* The file `src/routes/index.svelte` (or `src/routes/index.js`) corresponds to the root of your app. `src/routes/about/index.svelte` is treated the same as `src/routes/about.svelte`.\n* Files and directories with a leading underscore do *not* create routes. This allows you to colocate helper modules and components with the routes that depend on them — for example you could have a file called `src/routes/_helpers/datetime.js` and it would *not* create a `/_helpers/datetime` route.\n\n\n#### src/node_modules/images\n\nImages added to `src/node_modules/images` can be imported into your code using `import 'images/\u003cfilename\u003e'`. They will be given a dynamically generated filename containing a hash, allowing for efficient caching and serving the images on a CDN.\n\nSee [`index.svelte`](src/routes/index.svelte) for an example.\n\n\n#### src/node_modules/@sapper\n\nThis directory is managed by Sapper and generated when building. It contains all the code you import from `@sapper` modules.\n\n\n### static\n\nThe [static](static) directory contains static assets that should be served publicly. Files in this directory will be available directly under the root URL, e.g. an `image.jpg` will be available as `/image.jpg`.\n\nThe default [service-worker.js](src/service-worker.js) will preload and cache these files, by retrieving a list of `files` from the generated manifest:\n\n```js\nimport { files } from '@sapper/service-worker';\n```\n\nIf you have static files you do not want to cache, you should exclude them from this list after importing it (and before passing it to `cache.addAll`).\n\nStatic files are served using [sirv](https://github.com/lukeed/sirv).\n\n\n## Bundler configuration\n\nSapper uses Rollup or webpack to provide code-splitting and dynamic imports, as well as compiling your Svelte components. With webpack, it also provides hot module reloading. As long as you don't do anything daft, you can edit the configuration files to add whatever plugins you'd like.\n\n\n## Production mode and deployment\n\nTo start a production version of your app, run `npm run build \u0026\u0026 npm start`. This will disable live reloading, and activate the appropriate bundler plugins.\n\nYou can deploy your application to any environment that supports Node 10 or above. As an example, to deploy to [Vercel Now](https://vercel.com) when using `sapper export`, run these commands:\n\n```bash\nnpm install -g vercel\nvercel\n```\n\nIf your app can't be exported to a static site, you can use the [vercel-sapper](https://github.com/thgh/vercel-sapper) builder. You can find instructions on how to do so in its [README](https://github.com/thgh/vercel-sapper#basic-usage).\n\n\n## Using external components\n\nWhen using Svelte components installed from npm, such as [@sveltejs/svelte-virtual-list](https://github.com/sveltejs/svelte-virtual-list), Svelte needs the original component source (rather than any precompiled JavaScript that ships with the component). This allows the component to be rendered server-side, and also keeps your client-side app smaller.\n\nBecause of that, it's essential that the bundler doesn't treat the package as an *external dependency*. You can either modify the `external` option under `server` in [rollup.config.js](rollup.config.js) or the `externals` option in [webpack.config.js](webpack.config.js), or simply install the package to `devDependencies` rather than `dependencies`, which will cause it to get bundled (and therefore compiled) with your app:\n\n```bash\nnpm install -D @sveltejs/svelte-virtual-list\n```\n\n## Troubleshooting\n\nUsing Windows and WSL2? \n\nIf your project lives outside the WSL root directory, [this limitation](https://github.com/microsoft/WSL/issues/4169) is known to cause live-reloading to fail. See [this issue](https://github.com/sveltejs/sapper/issues/1150) for details.\n\n## Bugs and feedback\n\nSapper is in early development, and may have the odd rough edge here and there. Please be vocal over on the [Sapper issue tracker](https://github.com/sveltejs/sapper/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flelouchb%2Fsapper-cloudinary-upload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flelouchb%2Fsapper-cloudinary-upload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flelouchb%2Fsapper-cloudinary-upload/lists"}