{"id":27245280,"url":"https://github.com/davidcornu/mason","last_synced_at":"2025-07-13T12:06:07.702Z","repository":{"id":5212391,"uuid":"6388247","full_name":"davidcornu/mason","owner":"davidcornu","description":"A lightweight asset management middleware for Node.js","archived":false,"fork":false,"pushed_at":"2012-10-26T04:25:49.000Z","size":112,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-14T14:23:37.274Z","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":"GabrielAlva/Swift-Prompts","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidcornu.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":"2012-10-25T14:09:42.000Z","updated_at":"2013-01-12T20:12:44.000Z","dependencies_parsed_at":"2022-08-29T04:50:16.411Z","dependency_job_id":null,"html_url":"https://github.com/davidcornu/mason","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/davidcornu%2Fmason","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidcornu%2Fmason/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidcornu%2Fmason/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidcornu%2Fmason/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidcornu","download_url":"https://codeload.github.com/davidcornu/mason/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248298313,"owners_count":21080320,"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-04-10T21:11:04.073Z","updated_at":"2025-04-10T21:11:04.709Z","avatar_url":"https://github.com/davidcornu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mason\n\nA lightweight asset management middleware for Node.js.\n\nMason does not depend on any of its supported libraries. Instead, these are\nloaded from your application if they are detected, leaving you to decide what\nformats you wish to support.\n\nThe default behaviour is to serve files from the `./assets` directory when\nrequested with their target filename:\n\n`./assets/sidebar.coffee` \u0026rarr; `http://127.0.0.1:3000/sidebar.js`\n\n`./assets/stylesheets/footer.styl` \u0026rarr; `http://127.0.0.1:3000/stylesheets/footer.css`\n\nIn the case of templating libraries, they are compiled and wrapped into a\nglobal `window.JST` object, and served under a `.js` file extension.\n\n`./assets/templates/comment.eco` \u0026rarr; `http://127.0.0.1:3000/templates/comment.js`\n\nThey can then be accessed by passing their relative path to `JST`.\n\n```javascript\nvar templateVariables = { name: 'Bob' };\nvar html = JST['templates/comment'](templateVariables);\n```\n\n## Warning\n\nMason is an extremely young project and should be treated as such. \n\nBug reports, feature requests and contributions are most welcome.\n\n## Usage\n\n```javascript\nvar path  = require('path');\nvar mason = require('mason');\n\nmason.configure({\n  sourceDir: path.join(__dirname, 'assets'), // [./assets]\n  targetDir: path.join(__dirname, 'public'), // [./public]\n  saveFiles: true // [true]\n});\n\nmason.configure('coffee-script', { noWrap: true }); // Customize compiler options\n\napp.use(mason.middleware(module));\n```\n\n**Notes**\n\n- Passing `module` to `mason.middleware` is what allows Mason to load dependencies\nfrom your application's context instead of its own.\n- Setting `saveFiles` to `true` causes Mason to write the output of source files to the\ntarget directory when they are accessed. This allows you to have a continuously up\nto date version of your compiled assets availble.\n\n## Supported Libraries\n\n**Complete**\n\n- [CoffeeScript](https://github.com/jashkenas/coffee-script) - `.coffee`\n- [Less](https://github.com/cloudhead/less.js) - `.less`\n- [Stylus](https://github.com/LearnBoost/stylus) - `.styl`\n- [Eco](https://github.com/sstephenson/eco) - `.eco`\n- [EJS](https://github.com/visionmedia/ejs) - `.ejs`\n- [Hogan](https://github.com/twitter/hogan.js) - `.mustache`\n- [Handlebars](https://github.com/wycats/handlebars.js/) - `.handlebars`\n\n**Planned** (descending priority)\n\n- [UglifyJS](https://github.com/mishoo/UglifyJS)\n- [Haml Coffee](https://github.com/netzpirat/haml-coffee)\n- [Iced CoffeeScript](https://github.com/maxtaco/coffee-script/)\n- [Coco](https://github.com/satyr/coco)\n- [Pure](https://github.com/pure/pure)\n- [doT](https://github.com/olado/doT)\n- [CoffeeKup](https://github.com/mauricemach/coffeekup)\n\n## TODO\n\n- Simple directives (`//= require 'jquery.min.js'`)\n- Caching based on last-modified for when `saveFiles` is set to true.\n  - Cache hit: Call `next()` and let static middleware serve the file\n  - Cache miss: Compile, serve and save the file, update cache.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidcornu%2Fmason","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidcornu%2Fmason","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidcornu%2Fmason/lists"}