django-static-precompiler


Namedjango-static-precompiler JSON
Version 2.4 PyPI version JSON
download
home_pagehttps://github.com/andreyfedoseev/django-static-precompiler
SummaryDjango template tags to compile all kinds of static files
upload_time2022-12-28 13:55:25
maintainer
docs_urlNone
authorAndrey Fedoseev
requires_python>=3.6
license
keywords sass scss less stylus css coffeescript javascript babel livescript handlebars
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            ## Django Static Precompiler

Django Static Precompiler provides template tags and filters to compile
CoffeeScript, LiveScript, SASS / SCSS, LESS, Stylus, Babel and
Handlebars. It works with both inline code and external files.

[![Build Status](https://github.com/andreyfedoseev/django-static-precompiler/workflows/CI/badge.svg)](https://github.com/andreyfedoseev/django-static-precompiler/actions?query=workflow%3ACI)
[![Documentation](https://readthedocs.org/projects/django-static-precompiler/badge/)](https://django-static-precompiler.readthedocs.io/)

### Documentation

Documentation is available at
<https://django-static-precompiler.readthedocs.io>.

### Install

```sh
pip install django-static-precompiler
```

### Use in templates

```html
{% load compile_static %}
{% load static %}

<script src="{% static "path/to/script.coffee"|compile %}"></script>
<link rel="stylesheet" href="{% static "path/to/styles1.less"|compile %}" />
<link rel="stylesheet" href="{% static "path/to/styles2.scss"|compile %}" />
```

### Use in Python

```python
>>> from static_precompiler.utils import compile_static
>>> compile_static("styles.scss")
"COMPILED/styles.css"
```

### Python & Django compatibility

| django-static-precompiler | Python | Django     |
|---------------------------|--------|------------|
| 2.2+                      | 3.6+   | 2.0 - 4.1  |
| 2.1                       | 3.6+   | 2.0 - 4.0  |
| 2.0                       | 3.4+   | 1.9 - 3.2  |
| 1.7-1.8                   | 2.7+   | 1.7 - 2.2  |
| 1.6                       | 2.7+   | 1.7 - 1.11 |
| 1.5                       | 2.7+   | 1.6 - 1.10 |
| 1.1-1.4                   | 2.7+   | 1.6 - 1.9  |
| 1.0                       | 2.7+   | 1.6 - 1.7  |

## Changelog

### 2.4

#### Deprecation

- Ruby-based Sass compiler is deprecated and will be removed in 3.0

#### New

- Added support for Dart Sass, see documentation on how to enable it.
  Dart Sass will become the default Sass compiler starting from 3.0

#### Bugfixes

- Fix the bug with a greedy regex in the URL converter

#### Misc

- Ensure compatibility with the latest versions of compilers:
  - coffeescript@2.7.0 (may break compatibility with older versions)
  - livescript@1.6.0
  - less@4.1.3
  - handlebars@4.7.7

### 2.3

- Fix incorrect source map URL with `libsass`

### 2.2

- Add support for Django 4.1

### 2.1

- Drop Python 3.5 support
- Drop Django 1.x support
- Add support for Django 4.0

### 2.0

- Drop Python 2.x support
- Add support for Django 3.0 and 3.1

### 1.8.2

- Add `clean_css` option to LESS compiler
- Fix URL converter to properly handle `url(..)` not followed
  directly by `;`

### 1.8.1

- Fix `setup.py` to add compatibility with Python 3.4 and below.

### 1.8

- Remove deprecated settings: `COFFEESCRIPT_EXECUTABLE`,
  `SCSS_EXECUTABLE`, `SCSS_USE_COMPASS`, `LESS_EXECUTABLE`
- Add `--ignore-dependencies` option to `compilestatic` command
- Add `--delete-stale-files` option to `compilestatic` command

### 1.7.1

- Bugfix: properly handle the URLs containing parenthesis or quotes

### 1.7

- Prevent detection of imports in comments (SCSS)
- Add support for Django 2.0

### 1.6

- Add support for Django 1.11
- Drop support for Django 1.6
- Add `include_path` option to LESS compiler
- Take account of `load_paths` option when doing inline compilation
  with `libsass`
- Bugfix: take account of additional compiler options when doing
  inline compilation with SASS

### 1.5

- Add support for Django 1.10 and Python 3.5
- Improve support for `load_paths` setting in SCSS/SASS compilers.

### 1.4

- Fix the `run_command` utility function to rely on process return
  code rather than stderr to determine if compilation has finished
  successfully. WARNING! Changes in `run_command` are backward
  incompatible. If you use this function in your custom compiler you
  should update your code.

### 1.3.1

- Add support for `--presets` option in Babel compiler. See babel-cli
  [options \<https://babeljs.io/docs/usage/options/\>]{.title-ref} for
  more information.

### 1.3

- Fix Stylus compiler to actually enable support for detecting changes
  in imported files
- Add `precision` option to SASS / SCSS / LibSass compilers. Set it to
  8 or more if you compile Bootstrap.
- Add `output_style` option to SASS / SCSS / LibSass compilers.
- Enable verbose output for `compilestatic` management command

### 1.2

- Add LiveScript compiler
- Add support for `--global-var` option in LESS compiler
- Add SCSS / SASS compiler based on Libsass

### 1.1

- Add source maps support for SASS/SCSS
- Add source maps support for LESS
- Add source maps support for CoffeeScript
- Add source maps support for Stylus
- Add source maps support for Babel
- Add [Handlebars](http://handlebarsjs.com/) compiler
- Add support for Django 1.9
- Add `plugins` parameter to Babel compiler
- Add `load_paths` parameter to SASS/SCSS compilers

### 1.0.1

- Add `modules` parameter to Babel compiler
- Allow to install Watchdog with
  `pip install django-static-precompiler[watch]`

### 1.0

- Add `compile` template filter
- Deprecate `{% compile %}` template tag
- **The following compiler specific template tags are REMOVED:**
  - `{% coffeescript %}`
  - `{% inlinecoffeescript %}`
  - `{% sass %}`
  - `{% inlinesass %}`
  - `{% scss %}`
  - `{% inlinescss %}`
  - `{% less %}`
  - `{% inlineless %}`
- Add [Stylus](http://learnboost.github.io/stylus/) compiler

### 0.9

- Compiler options are specified with `STATIC_PRECOMPILER_COMPILERS`
  setting.
- **The following settings are DEPRECATED:**
  - `COFFEESCRIPT_EXECUTABLE`
  - `SCSS_EXECUTABLE`
  - `SCSS_USE_COMPASS`
  - `LESS_EXECUTABLE`
- `-C` (`--no-cache`) flag is removed from SASS/SCSS compilers
- Add `STATIC_PRECOMPILER_LIST_FILES` setting
- Add [Babel](https://babeljs.io) compiler

### 0.8

- Add `{% inlinecompile %}` template tag
- **The following compiler specific template tags are DEPRECATED:**
  - `{% coffeescript %}`
  - `{% inlinecoffeescript %}`
  - `{% sass %}`
  - `{% inlinesass %}`
  - `{% scss %}`
  - `{% inlinescss %}`
  - `{% less %}`
  - `{% inlineless %}`
- Use Django 1.7 migrations
- BUGFIX: fix sass imports from scss and vice versa
- BUGFIX: make sure that `compilestatic` works if `watchdog` isn\'t
  installed.
- BUGFIX: fix compilation error when dependency file was removed or
  renamed

### 0.7

- Add `compilestatic` management command (replaces
  `static_precompiler_watch`)
- Add `STATIC_PRECOMPILER_DISABLE_AUTO_COMPILE` to settings
- Add `STATIC_PRECOMPILER_CACHE_NAME` to settings
- Bugfixes

### 0.6

- Add `STATIC_PRECOMPILER_PREPEND_STATIC_URL` to settings
- Add `{% compile %}` template tag

### 0.5.3

- Update the parsing of `@import` statements. Fix the bug with URLs
  containing commas.

### 0.5.2

- `static_precompiler_watch`: watch for changes in all directories
  handled by static finders, not only `STATIC_ROOT`
- `static_precompiler_watch`: add `--no-initial-scan` option

### 0.5.1

- Fix SCSS compilation error when importing Compass styles

### 0.5

- Add Python 3 support

### 0.4

- Add `compile_static` and `compile_static_lazy` utility functions.

### 0.3

- Bug fixes
- Add Windows compatibility

### 0.2

- Reduce the max length of varchar fields in Dependency model to meet
  MySQL limitations
- static\_precompiler\_watch: don\'t fall with exception on
  compilation errors or if source file is not found

### 0.1

- Initial release

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/andreyfedoseev/django-static-precompiler",
    "name": "django-static-precompiler",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "sass,scss,less,stylus,css,coffeescript,javascript,babel,livescript,handlebars",
    "author": "Andrey Fedoseev",
    "author_email": "andrey@andreyfedoseev.com",
    "download_url": "https://files.pythonhosted.org/packages/09/bf/a8f0a07e954137d551c7fce53d48bc949ece9c3b8fbf559346a6922db0d9/django-static-precompiler-2.4.tar.gz",
    "platform": null,
    "description": "## Django Static Precompiler\n\nDjango Static Precompiler provides template tags and filters to compile\nCoffeeScript, LiveScript, SASS / SCSS, LESS, Stylus, Babel and\nHandlebars. It works with both inline code and external files.\n\n[![Build Status](https://github.com/andreyfedoseev/django-static-precompiler/workflows/CI/badge.svg)](https://github.com/andreyfedoseev/django-static-precompiler/actions?query=workflow%3ACI)\n[![Documentation](https://readthedocs.org/projects/django-static-precompiler/badge/)](https://django-static-precompiler.readthedocs.io/)\n\n### Documentation\n\nDocumentation is available at\n<https://django-static-precompiler.readthedocs.io>.\n\n### Install\n\n```sh\npip install django-static-precompiler\n```\n\n### Use in templates\n\n```html\n{% load compile_static %}\n{% load static %}\n\n<script src=\"{% static \"path/to/script.coffee\"|compile %}\"></script>\n<link rel=\"stylesheet\" href=\"{% static \"path/to/styles1.less\"|compile %}\" />\n<link rel=\"stylesheet\" href=\"{% static \"path/to/styles2.scss\"|compile %}\" />\n```\n\n### Use in Python\n\n```python\n>>> from static_precompiler.utils import compile_static\n>>> compile_static(\"styles.scss\")\n\"COMPILED/styles.css\"\n```\n\n### Python & Django compatibility\n\n| django-static-precompiler | Python | Django     |\n|---------------------------|--------|------------|\n| 2.2+                      | 3.6+   | 2.0 - 4.1  |\n| 2.1                       | 3.6+   | 2.0 - 4.0  |\n| 2.0                       | 3.4+   | 1.9 - 3.2  |\n| 1.7-1.8                   | 2.7+   | 1.7 - 2.2  |\n| 1.6                       | 2.7+   | 1.7 - 1.11 |\n| 1.5                       | 2.7+   | 1.6 - 1.10 |\n| 1.1-1.4                   | 2.7+   | 1.6 - 1.9  |\n| 1.0                       | 2.7+   | 1.6 - 1.7  |\n\n## Changelog\n\n### 2.4\n\n#### Deprecation\n\n- Ruby-based Sass compiler is deprecated and will be removed in 3.0\n\n#### New\n\n- Added support for Dart Sass, see documentation on how to enable it.\n  Dart Sass will become the default Sass compiler starting from 3.0\n\n#### Bugfixes\n\n- Fix the bug with a greedy regex in the URL converter\n\n#### Misc\n\n- Ensure compatibility with the latest versions of compilers:\n  - coffeescript@2.7.0 (may break compatibility with older versions)\n  - livescript@1.6.0\n  - less@4.1.3\n  - handlebars@4.7.7\n\n### 2.3\n\n- Fix incorrect source map URL with `libsass`\n\n### 2.2\n\n- Add support for Django 4.1\n\n### 2.1\n\n- Drop Python 3.5 support\n- Drop Django 1.x support\n- Add support for Django 4.0\n\n### 2.0\n\n- Drop Python 2.x support\n- Add support for Django 3.0 and 3.1\n\n### 1.8.2\n\n- Add `clean_css` option to LESS compiler\n- Fix URL converter to properly handle `url(..)` not followed\n  directly by `;`\n\n### 1.8.1\n\n- Fix `setup.py` to add compatibility with Python 3.4 and below.\n\n### 1.8\n\n- Remove deprecated settings: `COFFEESCRIPT_EXECUTABLE`,\n  `SCSS_EXECUTABLE`, `SCSS_USE_COMPASS`, `LESS_EXECUTABLE`\n- Add `--ignore-dependencies` option to `compilestatic` command\n- Add `--delete-stale-files` option to `compilestatic` command\n\n### 1.7.1\n\n- Bugfix: properly handle the URLs containing parenthesis or quotes\n\n### 1.7\n\n- Prevent detection of imports in comments (SCSS)\n- Add support for Django 2.0\n\n### 1.6\n\n- Add support for Django 1.11\n- Drop support for Django 1.6\n- Add `include_path` option to LESS compiler\n- Take account of `load_paths` option when doing inline compilation\n  with `libsass`\n- Bugfix: take account of additional compiler options when doing\n  inline compilation with SASS\n\n### 1.5\n\n- Add support for Django 1.10 and Python 3.5\n- Improve support for `load_paths` setting in SCSS/SASS compilers.\n\n### 1.4\n\n- Fix the `run_command` utility function to rely on process return\n  code rather than stderr to determine if compilation has finished\n  successfully. WARNING! Changes in `run_command` are backward\n  incompatible. If you use this function in your custom compiler you\n  should update your code.\n\n### 1.3.1\n\n- Add support for `--presets` option in Babel compiler. See babel-cli\n  [options \\<https://babeljs.io/docs/usage/options/\\>]{.title-ref} for\n  more information.\n\n### 1.3\n\n- Fix Stylus compiler to actually enable support for detecting changes\n  in imported files\n- Add `precision` option to SASS / SCSS / LibSass compilers. Set it to\n  8 or more if you compile Bootstrap.\n- Add `output_style` option to SASS / SCSS / LibSass compilers.\n- Enable verbose output for `compilestatic` management command\n\n### 1.2\n\n- Add LiveScript compiler\n- Add support for `--global-var` option in LESS compiler\n- Add SCSS / SASS compiler based on Libsass\n\n### 1.1\n\n- Add source maps support for SASS/SCSS\n- Add source maps support for LESS\n- Add source maps support for CoffeeScript\n- Add source maps support for Stylus\n- Add source maps support for Babel\n- Add [Handlebars](http://handlebarsjs.com/) compiler\n- Add support for Django 1.9\n- Add `plugins` parameter to Babel compiler\n- Add `load_paths` parameter to SASS/SCSS compilers\n\n### 1.0.1\n\n- Add `modules` parameter to Babel compiler\n- Allow to install Watchdog with\n  `pip install django-static-precompiler[watch]`\n\n### 1.0\n\n- Add `compile` template filter\n- Deprecate `{% compile %}` template tag\n- **The following compiler specific template tags are REMOVED:**\n  - `{% coffeescript %}`\n  - `{% inlinecoffeescript %}`\n  - `{% sass %}`\n  - `{% inlinesass %}`\n  - `{% scss %}`\n  - `{% inlinescss %}`\n  - `{% less %}`\n  - `{% inlineless %}`\n- Add [Stylus](http://learnboost.github.io/stylus/) compiler\n\n### 0.9\n\n- Compiler options are specified with `STATIC_PRECOMPILER_COMPILERS`\n  setting.\n- **The following settings are DEPRECATED:**\n  - `COFFEESCRIPT_EXECUTABLE`\n  - `SCSS_EXECUTABLE`\n  - `SCSS_USE_COMPASS`\n  - `LESS_EXECUTABLE`\n- `-C` (`--no-cache`) flag is removed from SASS/SCSS compilers\n- Add `STATIC_PRECOMPILER_LIST_FILES` setting\n- Add [Babel](https://babeljs.io) compiler\n\n### 0.8\n\n- Add `{% inlinecompile %}` template tag\n- **The following compiler specific template tags are DEPRECATED:**\n  - `{% coffeescript %}`\n  - `{% inlinecoffeescript %}`\n  - `{% sass %}`\n  - `{% inlinesass %}`\n  - `{% scss %}`\n  - `{% inlinescss %}`\n  - `{% less %}`\n  - `{% inlineless %}`\n- Use Django 1.7 migrations\n- BUGFIX: fix sass imports from scss and vice versa\n- BUGFIX: make sure that `compilestatic` works if `watchdog` isn\\'t\n  installed.\n- BUGFIX: fix compilation error when dependency file was removed or\n  renamed\n\n### 0.7\n\n- Add `compilestatic` management command (replaces\n  `static_precompiler_watch`)\n- Add `STATIC_PRECOMPILER_DISABLE_AUTO_COMPILE` to settings\n- Add `STATIC_PRECOMPILER_CACHE_NAME` to settings\n- Bugfixes\n\n### 0.6\n\n- Add `STATIC_PRECOMPILER_PREPEND_STATIC_URL` to settings\n- Add `{% compile %}` template tag\n\n### 0.5.3\n\n- Update the parsing of `@import` statements. Fix the bug with URLs\n  containing commas.\n\n### 0.5.2\n\n- `static_precompiler_watch`: watch for changes in all directories\n  handled by static finders, not only `STATIC_ROOT`\n- `static_precompiler_watch`: add `--no-initial-scan` option\n\n### 0.5.1\n\n- Fix SCSS compilation error when importing Compass styles\n\n### 0.5\n\n- Add Python 3 support\n\n### 0.4\n\n- Add `compile_static` and `compile_static_lazy` utility functions.\n\n### 0.3\n\n- Bug fixes\n- Add Windows compatibility\n\n### 0.2\n\n- Reduce the max length of varchar fields in Dependency model to meet\n  MySQL limitations\n- static\\_precompiler\\_watch: don\\'t fall with exception on\n  compilation errors or if source file is not found\n\n### 0.1\n\n- Initial release\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Django template tags to compile all kinds of static files",
    "version": "2.4",
    "split_keywords": [
        "sass",
        "scss",
        "less",
        "stylus",
        "css",
        "coffeescript",
        "javascript",
        "babel",
        "livescript",
        "handlebars"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "64f07d9d0a519407eed8d1fcb23bdd7e",
                "sha256": "5b67e951b19e1136f6bf00d879ae236435fe4be3e430369644743b1677645ce4"
            },
            "downloads": -1,
            "filename": "django_static_precompiler-2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "64f07d9d0a519407eed8d1fcb23bdd7e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 33966,
            "upload_time": "2022-12-28T13:55:23",
            "upload_time_iso_8601": "2022-12-28T13:55:23.644549Z",
            "url": "https://files.pythonhosted.org/packages/d5/c1/90b8ff7efdd04a0108fdc4743fae3d6eb990ee4ed581fb9d73345a0fd22a/django_static_precompiler-2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "41877a5e00f538b9410295abb2c4039c",
                "sha256": "22c983f4318f4ad96645d8b71af5c29d4525e55d0d5c3abe8917310280c7f89e"
            },
            "downloads": -1,
            "filename": "django-static-precompiler-2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "41877a5e00f538b9410295abb2c4039c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 24277,
            "upload_time": "2022-12-28T13:55:25",
            "upload_time_iso_8601": "2022-12-28T13:55:25.342881Z",
            "url": "https://files.pythonhosted.org/packages/09/bf/a8f0a07e954137d551c7fce53d48bc949ece9c3b8fbf559346a6922db0d9/django-static-precompiler-2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-28 13:55:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "andreyfedoseev",
    "github_project": "django-static-precompiler",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "django-static-precompiler"
}
        
Elapsed time: 0.35824s