{"id":15689452,"url":"https://github.com/masterkale/django-brunch-ts-scss","last_synced_at":"2025-03-30T12:12:13.901Z","repository":{"id":73085931,"uuid":"67449758","full_name":"MasterKale/django-brunch-ts-scss","owner":"MasterKale","description":"Figuring out how to cleanly transpile TypeScript and SCSS while keeping these files \"hidden\" from collectstatic","archived":false,"fork":false,"pushed_at":"2016-09-06T22:47:59.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-05T13:48:21.781Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/MasterKale.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-05T20:42:20.000Z","updated_at":"2018-08-17T21:13:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"885a543a-984d-4a29-9dd6-49efbdc3481f","html_url":"https://github.com/MasterKale/django-brunch-ts-scss","commit_stats":{"total_commits":6,"total_committers":2,"mean_commits":3.0,"dds":"0.33333333333333337","last_synced_commit":"9da6501abef75e154c1fa0cad24659713dfc02f7"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MasterKale%2Fdjango-brunch-ts-scss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MasterKale%2Fdjango-brunch-ts-scss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MasterKale%2Fdjango-brunch-ts-scss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MasterKale%2Fdjango-brunch-ts-scss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MasterKale","download_url":"https://codeload.github.com/MasterKale/django-brunch-ts-scss/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246314168,"owners_count":20757463,"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":"2024-10-03T18:02:13.276Z","updated_at":"2025-03-30T12:12:13.880Z","avatar_url":"https://github.com/MasterKale.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Django, TypeScript, and SCSS\n\n## Goal\n\nFigure out how to cleanly integrate TypeScript and SCSS into a Django app.\n\n## Status\n\nFor now I've settled on [Brunch.io](http://brunch.io/) and a couple of additional plugins. All required dependencies are listed in `package.json`.\n\nThe only thing that might need to be customized is the value of `watchDirectory` in `brunch-config.js`. Brunch relies on this to find the files for compilation, and also to strip out the folder name from the paths that are registered for each TypeScript file when they're converted into CommonJS modules.\n\nAdditionally, `package.json` scripts also assume that the Python virtual environment is located in `../venv/`. You can freely update these paths as needed.\n\n### Serving files for Development\n\nBrunch and Django can be run side-by-side during development. Just run `npm start` in one tab, and `python manage.py runserver` in another tag. Django's `{% static ... %}` notation can be used in templates as usual.\n\n### Serving files for Production\n\nTo concat, minify, and uglify everything for production , run `npm run build`. It runs `brunch build --prod` and follows up with Django's `collectstatic` command. Source maps are ignored by the staticfiles collector.\n\n\u003e NOTE: There's a **Windows-specific** build script - run `npm run build-win` instead\n\nOther than that you're free to structure your `.ts` and `.scss` files within your app as you please.\n\n### Calling a TypeScript module from within a template\n\nTo load specific TypeScript modules into a page's HTML template, just `require()` the desired TypeScript file:\n\n\t\u003c!-- templates/index.html --\u003e\n\t\u003cscript\u003e\n\t\t// .ts file is located in app_name/index/index.ts\n\t\trequire('index/index.ts');\n\t\u003c/script\u003e\n\nThe file will be executed upon page load.\n\nES6 imports work as expected, too:\n\n\t# ./foo.ts\n\texport class Foo {\n\t\tbar: string;\n\t\tconstructor(bar: string) {\n\t\t\tthis.bar = bar;\n\t\t}\n\n\t\tgreet() {\n\t\t\tconsole.log(this.bar);\n\t\t}\n\t}\n\n\t# ./index/index.ts\n\timport { Foo } from '../foo';\n\n\tlet foo = new Foo('hello');\n\tfoo.greet();\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasterkale%2Fdjango-brunch-ts-scss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmasterkale%2Fdjango-brunch-ts-scss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasterkale%2Fdjango-brunch-ts-scss/lists"}