Skip to content

Commit 4ce5a43

Browse files
author
bdauer
committed
Removed type from link and script tags
1 parent 9d9a97c commit 4ce5a43

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ WEBPACK_LOADER = {
123123
If the bundle generates a file called `main-cf4b5fab6e00a404e0c7.js` and your STATIC_URL is `/static/`, then the `<script>` tag will look like this
124124

125125
```html
126-
<script type="text/javascript" src="/static/output/bundles/main-cf4b5fab6e00a404e0c7.js"/>
126+
<script src="/static/output/bundles/main-cf4b5fab6e00a404e0c7.js"/>
127127
```
128128
129129
<br>
@@ -304,8 +304,8 @@ the function in the `webpack_loader.utils` module.
304304
[{'url': '/static/bundles/main.js', u'path': u'/home/mike/root/projects/django-webpack-loader/tests/assets/bundles/main.js', u'name': u'main.js'},
305305
{'url': '/static/bundles/styles.css', u'path': u'/home/mike/root/projects/django-webpack-loader/tests/assets/bundles/styles.css', u'name': u'styles.css'}]
306306
>>> utils.get_as_tags('main')
307-
['<script type="text/javascript" src="/static/bundles/main.js" ></script>',
308-
'<link type="text/css" href="/static/bundles/styles.css" rel="stylesheet" />']
307+
['<script src="/static/bundles/main.js" ></script>',
308+
'<link href="/static/bundles/styles.css" rel="stylesheet" />']
309309
```
310310
311311
## How to use in Production

tests/app/tests/test_webpack.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ def test_templatetags(self):
109109
view = TemplateView.as_view(template_name='home.html')
110110
request = self.factory.get('/')
111111
result = view(request)
112-
self.assertIn('<link type="text/css" href="/static/bundles/styles.css" rel="stylesheet" />', result.rendered_content)
113-
self.assertIn('<script type="text/javascript" src="/static/bundles/main.js" async charset="UTF-8"></script>', result.rendered_content)
112+
self.assertIn('<link href="/static/bundles/styles.css" rel="stylesheet" />', result.rendered_content)
113+
self.assertIn('<script src="/static/bundles/main.js" async charset="UTF-8"></script>', result.rendered_content)
114114

115-
self.assertIn('<link type="text/css" href="/static/bundles/styles-app2.css" rel="stylesheet" />', result.rendered_content)
116-
self.assertIn('<script type="text/javascript" src="/static/bundles/app2.js" ></script>', result.rendered_content)
115+
self.assertIn('<link href="/static/bundles/styles-app2.css" rel="stylesheet" />', result.rendered_content)
116+
self.assertIn('<script src="/static/bundles/app2.js" ></script>', result.rendered_content)
117117
self.assertIn('<img src="/static/my-image.png"/>', result.rendered_content)
118118

119119
view = TemplateView.as_view(template_name='only_files.html')
@@ -159,7 +159,7 @@ def test_jinja2(self):
159159
request = self.factory.get('/')
160160
result = view(request)
161161
self.assertIn('<link type="text/css" href="/static/bundles/styles.css" rel="stylesheet" />', result.rendered_content)
162-
self.assertIn('<script type="text/javascript" src="/static/bundles/main.js" async charset="UTF-8"></script>', result.rendered_content)
162+
self.assertIn('<script src="/static/bundles/main.js" async charset="UTF-8"></script>', result.rendered_content)
163163

164164
def test_reporting_errors(self):
165165
self.compile_bundles('webpack.config.error.js')

webpack_loader/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ def get_as_tags(bundle_name, extension=None, config='DEFAULT', attrs=''):
4747
for chunk in bundle:
4848
if chunk['name'].endswith(('.js', '.js.gz')):
4949
tags.append((
50-
'<script type="text/javascript" src="{0}" {1}></script>'
50+
'<script src="{0}" {1}></script>'
5151
).format(chunk['url'], attrs))
5252
elif chunk['name'].endswith(('.css', '.css.gz')):
5353
tags.append((
54-
'<link type="text/css" href="{0}" rel="stylesheet" {1}/>'
54+
'<link href="{0}" rel="stylesheet" {1}/>'
5555
).format(chunk['url'], attrs))
5656
return tags
5757

0 commit comments

Comments
 (0)