{"id":17659741,"url":"https://github.com/raphamorim/nautilus.js","last_synced_at":"2025-07-29T06:32:45.322Z","repository":{"id":57113557,"uuid":"98304718","full_name":"raphamorim/nautilus.js","owner":"raphamorim","description":"Async CSS/JavaScript loader \u0026 dependency manager in ~1kb (600B gziped)","archived":false,"fork":false,"pushed_at":"2019-03-23T15:05:27.000Z","size":77,"stargazers_count":19,"open_issues_count":3,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-06T19:45:23.790Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raphamorim.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":"2017-07-25T12:40:01.000Z","updated_at":"2024-11-17T10:39:15.000Z","dependencies_parsed_at":"2022-08-21T22:40:38.134Z","dependency_job_id":null,"html_url":"https://github.com/raphamorim/nautilus.js","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/raphamorim/nautilus.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphamorim%2Fnautilus.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphamorim%2Fnautilus.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphamorim%2Fnautilus.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphamorim%2Fnautilus.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raphamorim","download_url":"https://codeload.github.com/raphamorim/nautilus.js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphamorim%2Fnautilus.js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267639569,"owners_count":24119780,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2024-10-23T16:08:09.530Z","updated_at":"2025-07-29T06:32:45.298Z","avatar_url":"https://github.com/raphamorim.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nautilus.js\n\n\u003e Async CSS/JavaScript loader \u0026 dependency manager in ~1kb (600B gziped)\n\n[![Coverage Status](https://coveralls.io/repos/github/raphamorim/nautilus.js/badge.svg?branch=master)](https://coveralls.io/github/raphamorim/nautilus.js?branch=master)\n\nUsed by [G1's globocom](http://g1.globo.com), [Jusbrasil](http://www.jusbrasil.com.br/home)\n\n## Why?\n\n#### Old School\n\nblocks CSS, Images and JavaScript.\n\n\n```html\n\u003clink href=\"bootstrap.css\"\u003e\n\u003cscript src=\"jquery.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"my-jquery-plugin.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"my-app-that-uses-plugin.js\"\u003e\u003c/script\u003e\n```\n\n#### Middle School\n\nloads as non-blocking, however one has to use an API definition as AMD or commonjs. This affects all the other scripts (including plugins).\n\n```html\n\u003c!-- AMD LOADER EXAMPLE --\u003e\n\u003cscript\u003e\nrequire(['jquery'], function($) {\n  console.log($); // function (a,b){return new n.fn.init(a,b)}\n\n  require(['my-jquery-plugin'], function() {\n    /*\n      If jquery plugin has an anonymous define, throw an error: Mismatched anonymous define() module...\n    */\n  });\n});\n\u003c/script\u003e\n```\n\n#### New School\n\nloads as non-blocking too, however Nautilus.js doesn't care if it's an anonymous define, has unexported module or things like that.\n\n```html\n\u003cscript\u003e\n  nautilus.config({\n    paths: {\n      bootstrap: 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css',\n      'jquery': 'libs/jquery.js',\n      'jquery.nanoscroller': 'libs/jquery-nanoscroller.js',\n      'waterfall': 'http://cdnjs.cloudflare.com/ajax/libs/waterfall.js/1.0.2/waterfall.min.js'\n    }\n  });\n\n  nautilus(['bootstrap', 'jquery', 'waterfall'], ['jquery.nanoscroller'], function() {\n    console.log($); // function (a,b){return new n.fn.init(a,b)}\n    console.log(typeof($.fn.nanoScroller)); // 'function'\n  });\n\u003c/script\u003e\n```\n\n#### What's the biggest difference about the [current top script loaders](http://www.creativebloq.com/javascript/essential-javascript-top-five-script-loaders-8122862)?\n\nNautilus can define namespaces to asset paths/links and you can manage easily. Besides 7~20x more lighter.\n\n## Getting\n\nFirst of all, get Nautilus.js using [Download Option](https://github.com/raphamorim/nautilus.js/archive/master.zip) or via package manager.\n\nTo get using [Bower](http://bower.io) just run this command:\n\n```sh\nbower install nautilusjs\n```\n\nOr get using NPM just run this command:\n\n```sh\nnpm install nautilusjs\n```\n\n## Usage\n\nTo define specified `paths`, you must use the config method:\n\n```js\nnautilus.config({\n    paths: {\n        'jquery': 'libs/jquery.js',\n        'waterfall': 'http://cdnjs.cloudflare.com/ajax/libs/waterfall.js/1.0.2/waterfall.min.js'\n    }\n});\n```\n\nOr you can pass an array, now it will try to download the asset once in order, falling back to the next URL if fails, like this:\n\n```js\nnautilus.config({\n  paths: {\n    jquery: [\n      'https://public.cdn.com/libs/jquery.min.js',\n      'https://private.cdn.com/libs/jquery.min.js',\n    ],\n    waterfall: [\n      'http://cdnjs.cloudflare.com/ajax/libs/waterfall.js/1.0.2/waterfall.min.js',\n      'http://www.mydomain.com/js/1.0.2/waterfall.min.js'\n    ]\n  }\n});\n```\n\nTo asynchronous download the assets:\n\n```js\nnautilus(['jquery', 'waterfall'], function() {\n    console.log($); // function (a,b){return new n.fn.init(a,b)}\n    console.log(typeof(waterfall)); // 'function'\n});\n```\n\n### Optional parameters\nYou can also set `origins` for your relative URLs, it will concatenate the origin and the path and try to load once, so if the download fails in the first domain, it will try to download in the second and so on.\n```js\nnautilus.config({\n  origins: ['https://public.cdn.com', 'https://private.cdn.com', 'https://s3.com'],\n  paths: { jquery: '/libs/jquery.min.js' }\n});\nnautilus(['jquery']);\n```\n\nWith this it will request the jQuery file in the following URLs:\n1. `https://public.cdn.com/libs/jquery.min.js`\n2. `https://private.cdn.com/libs/jquery.min.js`\n3. `https://s3.com/libs/jquery.min.js`\n4. `/libs/jquery.min.js`\n\n\n## Browser Support\n\n| \u003cimg src=\"http://raphamorim.io/assets/images/browser-support/chrome.png\" width=\"100px\" height=\"100px\" alt=\"Chrome logo\"\u003e | \u003cimg src=\"http://raphamorim.io/assets/images/browser-support/firefox.png\" width=\"100px\" height=\"100px\" alt=\"Firefox logo\"\u003e | \u003cimg src=\"http://raphamorim.io/assets/images/browser-support/ie.png\" width=\"100px\" height=\"100px\" alt=\"Internet Explorer logo\"\u003e | \u003cimg src=\"http://raphamorim.io/assets/images/browser-support/opera.png\" width=\"100px\" height=\"100px\" alt=\"Opera logo\"\u003e | \u003cimg src=\"http://raphamorim.io/assets/images/browser-support/safari.png\" width=\"100px\" height=\"100px\" alt=\"Safari logo\"\u003e |\n|:---:|:---:|:---:|:---:|:---:|\n| 35+ ✔ | 38+ ✔ | 9+ ✔ | 29+ ✔ |  8+ ✔ |\n\n## Credits\n\nMade by [@raphamorims](https://twitter.com/raphamorims) and awesome [contributors](https://github.com/raphamorim/nautilus.js/graphs/contributors)\n\nLicense: MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphamorim%2Fnautilus.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraphamorim%2Fnautilus.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphamorim%2Fnautilus.js/lists"}