Developers often need to link directly to files hosted on GitHub, such as CSS or JavaScript files, but GitHub's raw file URLs return a Content-Type
of text/plain
, making it unusable for direct embedding in websites. RawGit bridges this gap by serving raw files directly from GitHub with the correct Content-Type
headers, allowing developers to use GitHub as a CDN for their projects.
RawGit generates two URLs for each file: a production-ready CDN URL and a development URL. The CDN URL is served through StackPath's content delivery network, offering fast and stable access. The development URL provides more immediate updates but is not intended for heavy usage.
Content-Type
headersTo use RawGit, simply paste the GitHub file URL into the RawGit homepage, and it generates the CDN and development URLs. For production environments, use the CDN URL for better performance.
RawGit is currently in a sunset phase and will be shutting down. Existing URLs that have been accessed within the last month will continue to be served until at least October 2019. Developers are advised to switch to alternative services like jsDelivr, GitHub Pages, CodeSandbox, or unpkg.