5 ms·
For https://devel.tech https://devel.tech and https://www.hskflashcards.com https://www.hskflashcards.com, I split the common JS, SCSS, and Python code into a g
by git-pull 9y ago
For https://devel.tech https://devel.tech and https://www.hskflashcards.com https://www.hskflashcards.com, I split the common JS, SCSS, and Python code into a git submodule.
I named my common library "based":
- Uses reStructuredText + docutils to display content in a consistent fashion (https://devel.tech/features/django-vs-flask/ https://devel.tech/features/django-vs-flask/, https://www.hskflashcards.com/downloads https://www.hskflashcards.com/downloads)
- Common fabric source code for deploying Django websites, updating the sites
- Customized crispy-form templates and SCSS files
- Using Yarn "Workspaces" to load the common JS/SAAS code (https://yarnpkg.com/lang/en/docs/workspaces/ https://yarnpkg.com/lang/en/docs/workspaces/)
- In Webpack, I share common webpack code via wrapping the configs in a function and passing in dependencies.
- Common Python code is available to be accessed for reusable Django applications, but also plain-old python
- And use of "import_string" in django settings to load additional plugin configurations [1]
[1] https://docs.djangoproject.com/en/1.11/ref/utils/#django.utils.module_loading.import_string https://docs.djangoproject.com/en/1.11/ref/utils/#django.uti...
P.S. I am writing an article (in draft atm) about import_strings in Django at https://devel.tech/tips/n/djms3tTe/demystifying-djangos-import-strings/ https://devel.tech/tips/n/djms3tTe/demystifying-djangos-impo..., intended for people new to Python and Django. You can also use import_string in your own Django code to 'opt-in' to any sort of feature you keep in a common codebase. In my circumstance, I use it as a way to register docutils roles and directives via django settings. This pattern also holds true without Django, too (https://docs.python.org/3/library/importlib.html https://docs.python.org/3/library/importlib.html).
P.P.S. I highly recommend Yarn Workspaces. It's fast, and really makes it a lot easier to share front-end code.