summaryrefslogtreecommitdiff
path: root/python-django-compress-staticfiles.spec
blob: 93a2efbb57c4e42083560b9dffa6fb7ad21ba724 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
%global _empty_manifest_terminate_build 0
Name:		python-django-compress-staticfiles
Version:	1.0.1b0
Release:	1
Summary:	A static files storage backend for compression using GZip and/or Brotli that inherits from Djangos ManifestFilesMixin and StaticFilesStorage; also minifies static files.
License:	GPL-3.0
URL:		https://github.com/armandtvz/django-compress-staticfiles
Source0:	https://mirrors.nju.edu.cn/pypi/web/packages/64/cc/24ab289c1c2563033f7096fae679364b8afbceb10d53d2d070d3c7083076/django-compress-staticfiles-1.0.1b0.tar.gz
BuildArch:	noarch

Requires:	python3-Django
Requires:	python3-Brotli
Requires:	python3-csscompressor
Requires:	python3-rjsmin

%description
A Django static files storage backend inheriting from [ManifestFilesMixin][16]
and [StaticFilesStorage][12]. Compresses, using GZip and/or Brotli, and minifies
static files when running the Django [collectstatic][5] command.
### What this package does:
- Compresses static files using [Brotli][1] and/or GZip. See the [included
  filetypes][100] heading to see which filetypes are compressed.
- Minifies JS using [rJSMin][19].
- Minifies CSS using [csscompressor][6].
### What this package does *not* do:
- Does not support concatenation/bundling of JS or CSS.
- Does not support transpiling from any transpiling Javascript language.
- Does not support [SASS][13], [LESS][14] or any other CSS preprocessor.
- This package is not a linter or tester. The collectstatic command is not the
  place to be linting or testing your code. The primary purpose of this package
  is compressing staticfiles for use in staging or production environments —
  minification is optional but does so by default.
- Does not delete stale files from your `STATIC_ROOT` directory. If changes were
  made to some of your static files; old files will remain there. Use the
  `--clear` flag when running `collectstatic` to delete the entire `STATIC_ROOT`
  and recreate it — check out the Django docs for more info.
### Some important things to take note of:
- If `DEBUG = True` in your Django settings.py file; only the normal file
  is used in templates. Templates will only use the hashed and minified
  version of the file when `DEBUG = False`. This is the behaviour of the Django
  [staticfiles][15] app in the `url` method of the `ManifestFilesMixin`.
- The compressed version of the file is never used in the template. Your
  webserver can decide which version of the file to serve depending on the
  Accept-Encoding header in the request.
- This package updates the manifest JSON file created by ManifestFilesMixin
  with a path pointing to the hashed *and* minified version of each processed
  file where applicable.
- If there is a `.min` file to be copied to STATIC_ROOT; that file will be
  compressed but not re-minified. If that `.min` file has a corresponding
  non-minified counterpart, that non-minified file *will* be minified and
  that minified file is the one that will be used to map `regular.css` to
  `regular.min.{hash}.css` in the manifest file.
- This package does not yet deal with the @import rule and url() function in
  CSS; therefore the value is not updated after ManifestFilesMixin handles those
  things — the minified file will not be referenced, only the hashed version as
  substituted by ManifestFilesMixin.
- The original files, for example, `somefile.css` won't be compressed
  to `somefile.css.gz` because we will likely never use it.
- Files smaller than 200 bytes will not be compressed.
### Usage with cloud storage like Google Cloud Storage or Amazon S3:
Even though the CompressStaticFilesStorage inherits from StaticFilesStorage,
which inherits from FileSystemStorage, the CompressStaticFilesMixin and
MinifyFilesMixin can be used with your own storage.

%package -n python3-django-compress-staticfiles
Summary:	A static files storage backend for compression using GZip and/or Brotli that inherits from Djangos ManifestFilesMixin and StaticFilesStorage; also minifies static files.
Provides:	python-django-compress-staticfiles
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-pip
%description -n python3-django-compress-staticfiles
A Django static files storage backend inheriting from [ManifestFilesMixin][16]
and [StaticFilesStorage][12]. Compresses, using GZip and/or Brotli, and minifies
static files when running the Django [collectstatic][5] command.
### What this package does:
- Compresses static files using [Brotli][1] and/or GZip. See the [included
  filetypes][100] heading to see which filetypes are compressed.
- Minifies JS using [rJSMin][19].
- Minifies CSS using [csscompressor][6].
### What this package does *not* do:
- Does not support concatenation/bundling of JS or CSS.
- Does not support transpiling from any transpiling Javascript language.
- Does not support [SASS][13], [LESS][14] or any other CSS preprocessor.
- This package is not a linter or tester. The collectstatic command is not the
  place to be linting or testing your code. The primary purpose of this package
  is compressing staticfiles for use in staging or production environments —
  minification is optional but does so by default.
- Does not delete stale files from your `STATIC_ROOT` directory. If changes were
  made to some of your static files; old files will remain there. Use the
  `--clear` flag when running `collectstatic` to delete the entire `STATIC_ROOT`
  and recreate it — check out the Django docs for more info.
### Some important things to take note of:
- If `DEBUG = True` in your Django settings.py file; only the normal file
  is used in templates. Templates will only use the hashed and minified
  version of the file when `DEBUG = False`. This is the behaviour of the Django
  [staticfiles][15] app in the `url` method of the `ManifestFilesMixin`.
- The compressed version of the file is never used in the template. Your
  webserver can decide which version of the file to serve depending on the
  Accept-Encoding header in the request.
- This package updates the manifest JSON file created by ManifestFilesMixin
  with a path pointing to the hashed *and* minified version of each processed
  file where applicable.
- If there is a `.min` file to be copied to STATIC_ROOT; that file will be
  compressed but not re-minified. If that `.min` file has a corresponding
  non-minified counterpart, that non-minified file *will* be minified and
  that minified file is the one that will be used to map `regular.css` to
  `regular.min.{hash}.css` in the manifest file.
- This package does not yet deal with the @import rule and url() function in
  CSS; therefore the value is not updated after ManifestFilesMixin handles those
  things — the minified file will not be referenced, only the hashed version as
  substituted by ManifestFilesMixin.
- The original files, for example, `somefile.css` won't be compressed
  to `somefile.css.gz` because we will likely never use it.
- Files smaller than 200 bytes will not be compressed.
### Usage with cloud storage like Google Cloud Storage or Amazon S3:
Even though the CompressStaticFilesStorage inherits from StaticFilesStorage,
which inherits from FileSystemStorage, the CompressStaticFilesMixin and
MinifyFilesMixin can be used with your own storage.

%package help
Summary:	Development documents and examples for django-compress-staticfiles
Provides:	python3-django-compress-staticfiles-doc
%description help
A Django static files storage backend inheriting from [ManifestFilesMixin][16]
and [StaticFilesStorage][12]. Compresses, using GZip and/or Brotli, and minifies
static files when running the Django [collectstatic][5] command.
### What this package does:
- Compresses static files using [Brotli][1] and/or GZip. See the [included
  filetypes][100] heading to see which filetypes are compressed.
- Minifies JS using [rJSMin][19].
- Minifies CSS using [csscompressor][6].
### What this package does *not* do:
- Does not support concatenation/bundling of JS or CSS.
- Does not support transpiling from any transpiling Javascript language.
- Does not support [SASS][13], [LESS][14] or any other CSS preprocessor.
- This package is not a linter or tester. The collectstatic command is not the
  place to be linting or testing your code. The primary purpose of this package
  is compressing staticfiles for use in staging or production environments —
  minification is optional but does so by default.
- Does not delete stale files from your `STATIC_ROOT` directory. If changes were
  made to some of your static files; old files will remain there. Use the
  `--clear` flag when running `collectstatic` to delete the entire `STATIC_ROOT`
  and recreate it — check out the Django docs for more info.
### Some important things to take note of:
- If `DEBUG = True` in your Django settings.py file; only the normal file
  is used in templates. Templates will only use the hashed and minified
  version of the file when `DEBUG = False`. This is the behaviour of the Django
  [staticfiles][15] app in the `url` method of the `ManifestFilesMixin`.
- The compressed version of the file is never used in the template. Your
  webserver can decide which version of the file to serve depending on the
  Accept-Encoding header in the request.
- This package updates the manifest JSON file created by ManifestFilesMixin
  with a path pointing to the hashed *and* minified version of each processed
  file where applicable.
- If there is a `.min` file to be copied to STATIC_ROOT; that file will be
  compressed but not re-minified. If that `.min` file has a corresponding
  non-minified counterpart, that non-minified file *will* be minified and
  that minified file is the one that will be used to map `regular.css` to
  `regular.min.{hash}.css` in the manifest file.
- This package does not yet deal with the @import rule and url() function in
  CSS; therefore the value is not updated after ManifestFilesMixin handles those
  things — the minified file will not be referenced, only the hashed version as
  substituted by ManifestFilesMixin.
- The original files, for example, `somefile.css` won't be compressed
  to `somefile.css.gz` because we will likely never use it.
- Files smaller than 200 bytes will not be compressed.
### Usage with cloud storage like Google Cloud Storage or Amazon S3:
Even though the CompressStaticFilesStorage inherits from StaticFilesStorage,
which inherits from FileSystemStorage, the CompressStaticFilesMixin and
MinifyFilesMixin can be used with your own storage.

%prep
%autosetup -n django-compress-staticfiles-1.0.1b0

%build
%py3_build

%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
	find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
	find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
	find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
	find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
	find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .

%files -n python3-django-compress-staticfiles -f filelist.lst
%dir %{python3_sitelib}/*

%files help -f doclist.lst
%{_docdir}/*

%changelog
* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 1.0.1b0-1
- Package Spec generated