{"id":28220871,"url":"https://github.com/morulus/vendor","last_synced_at":"2025-06-26T23:04:52.373Z","repository":{"id":22452050,"uuid":"25790501","full_name":"morulus/vendor","owner":"morulus","description":"Vendor.js it's another way to use AMD on frontend.","archived":false,"fork":false,"pushed_at":"2016-10-26T10:49:11.000Z","size":372,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"gh-pages","last_synced_at":"2025-05-21T11:51:54.073Z","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":"Homebrew/legacy-homebrew","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/morulus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.MD","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-26T20:52:54.000Z","updated_at":"2016-10-23T14:44:12.000Z","dependencies_parsed_at":"2022-08-20T17:00:43.057Z","dependency_job_id":null,"html_url":"https://github.com/morulus/vendor","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morulus%2Fvendor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morulus%2Fvendor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morulus%2Fvendor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morulus%2Fvendor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morulus","download_url":"https://codeload.github.com/morulus/vendor/tar.gz/refs/heads/gh-pages","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morulus%2Fvendor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259047872,"owners_count":22797614,"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-05-18T04:16:24.075Z","updated_at":"2025-06-10T09:30:37.941Z","avatar_url":"https://github.com/morulus.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Vedor.js\n======\n\nVendor.js is another way to use AMD on frontend.\n\n## Connect to page\nPut vendor.js into public root of your project. Connect vendor.js to your page:\n```html\n\u003cscript src=\"myproject/vendor.js\"\u003e\u003c/script\u003e\n```\nNow, vendor.js is ready to work. Option `baseUrl` in library configuration become automaticly to 'myproject/'. WHat it means? Any request with relative paths will search file in the `baseUrl` folder. For example:\n\n### getting js file from the folder `myproject/js`\n```javascript\nvendor('js/myscript.js');\n```\nIt will load `myproject/js/myscript.js`. Capish?\n\n_So, you can get many files:_\n```javascript\nvendor(['js/myscript.js','bower_components/jquery/dist/jquery.js','widgets/callback/callback.js']);\n```\n_Or, get different types of files:_\n```javascript\nvendor(['js/myscript.js','style/main.css','images/background.jpg']);\n```\n\n### Use depends\nAs well as in the RequireJs it's supports dependencies. If your module supports define(), you can get the fabric of module by the vendor() function. Just like this:\n```javascript\nvendor('bower_components/jquery/dist/jquery.js', function($) {\n    $(\"body\").html(\"jQuery connected!\");\n});\n```\n\n_You can use nesting:_\n```javascript\nvendor('bower_components/jquery/dist/jquery.js', function() {\n  vendor('js/myscript.js', function(my) {\n});\n});\n```\n\n_Or, run your script only after loading images_\nAnd that script which you intend to use, you can load in one queue with other images.\n```javascript\nvendor(['js/gallery.js','image1.jpg','image2.jpg','image3.jpg'], function(makegallery, image1,image2,image3) {\n makegallery(image1,image2,image3);\n});\n```\nBrilliant?\n\n### Talk about bower components\n_Load bower package by the force_\n```javascript\nvendor(['bower//bootstrap'], function() {\n // Bootstrap just ready\n});\n```\nWell. Do you think this record loads only bootstrap.js? No, you're wrong. It loads all files you need from this package (js and css, if you remember). You can say enough, but it is not. Bootstrap required jQuery, so that simple record loads jQuery too from bower_components/ folder.\n\nYou can change default bower folder by the calling function vendor.config({bowerUrl:'mybowers/'}) or by the _.bowerrc_ file in the root folder of project. Vendor.js will inspect this file and get option `direction` to use it.\n\n### Define\n_You can use define() function:_\n```javascript\ndefine('mymodule', ['js/myscript.js'], function() {\n  return {\n    hello: function() { alert('Hello'); }\n  }\n});\n```\n\n### Relative paths in define\n```javascript\ndefine('magic', ['.myscript2.js'], function() {\n  return 'ok';\n});\n```\n\n### Getting css files\nYou can get CSS files as well as get Js-files with function vendor.requirecss(string || array) or vendor(string || array)\n```javascript\nvendor(\"css/main.css\");\n```\n\n### baseUrl\nBy defaults Vendor.js chooses `baseUrl` by getting location of vendor.js. Don't rename file `vendor.js`! This name is a anchor to search base location. But if you will, you can configure this option manualy:\n```javascript\nvendor.config({\n    baseUrl: 'mynewfolder/scripts/'\n});\n```\nThis script will get file `mynewfolder/scripts/foo.js'\n```\nvendor('foo');\n```\n\n### Debug\nDebugging works with two functions: debug() and watch()\n\n#### debug()\nUse vendor.debug function to see reports in console\n```\nvendor.config({\n    paths: {\n        'jquery': 'vendor/jquery/dist/jquery'\n    }\n});\nvendor('jquery');\n```\n\n#### watch(filename) \nUse vendor.watch to watch reports only for [filename]\n```\nvendor.watch('file.js', ['./load/my/file.js'], function() {});\n```\n\n## Browsers supports\nChrome,FF,Opera,Safari,webkit's browser in short, IE8+\n\n## Author\nVladimir Morulus (https://github.com/morulus/)\n\n## Why reinvent the wheel??\nWhat different between Requirejs, for example? — you can say. Simple reasons — the existence of Coca-Cola exclude the existence of other drinks? Good day.\n\n## P.S\nSorry my english.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorulus%2Fvendor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorulus%2Fvendor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorulus%2Fvendor/lists"}