Browse Source

resume forma de lidar com com chunks css e js

pull/2485/head
Leandro Roberto 7 years ago
parent
commit
18002d63ff
  1. 14
      sapl-frontend/src/global/main.js
  2. 1
      sapl/static/css/image_cropping.8608d5e7.css
  3. 2516
      sapl/static/js/chunk-vendors.962fb9e0.js
  4. 240
      sapl/static/js/compilacao.196359a8.js
  5. 316
      sapl/static/js/global.32642276.js
  6. 195
      sapl/static/js/image_cropping.c0e3598f.js
  7. 14
      sapl/static/js/jquery_mask_plugin.8c657459.js
  8. 27
      sapl/templates/base.html
  9. 8
      sapl/templates/compilacao/base_compilacao.html
  10. 12
      sapl/templates/norma/normajuridica_detail.html
  11. 2
      webpack-stats.json

14
sapl-frontend/src/global/main.js

@ -5,19 +5,9 @@ import 'webpack-jquery-ui/sortable'
import './functions' import './functions'
import( import 'jquery-mask-plugin'
/* webpackChunkName: "jquery_mask_plugin" */
'jquery-mask-plugin')
.then(jquery_mask_plugin => {
jquery_mask_plugin.default()
})
import( import './image_cropping'
/* webpackChunkName: "image_cropping" */
'./image_cropping')
.then(image_cropping => {
image_cropping.default()
})
// eslint-disable-next-line // eslint-disable-next-line
require('imports-loader?window.jQuery=jquery!./jquery.runner.js') require('imports-loader?window.jQuery=jquery!./jquery.runner.js')

1
sapl/static/css/image_cropping.8608d5e7.css

@ -1 +0,0 @@
.jcrop-holder{-ms-touch-action:none;direction:ltr;text-align:left}.jcrop-hline,.jcrop-vline{background:#fff url(data:image/gif;base64,R0lGODlhCAAIAJEAAKqqqv///wAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJCgAAACwAAAAACAAIAAACDZQFCadrzVRMB9FZ5SwAIfkECQoAAAAsAAAAAAgACAAAAg+ELqCYaudeW9ChyOyltQAAIfkECQoAAAAsAAAAAAgACAAAAg8EhGKXm+rQYtC0WGl9oAAAIfkECQoAAAAsAAAAAAgACAAAAg+EhWKQernaYmjCWLF7qAAAIfkECQoAAAAsAAAAAAgACAAAAg2EISmna81UTAfRWeUsACH5BAkKAAAALAAAAAAIAAgAAAIPFA6imGrnXlvQocjspbUAACH5BAkKAAAALAAAAAAIAAgAAAIPlIBgl5vq0GLQtFhpfaIAACH5BAUKAAAALAAAAAAIAAgAAAIPlIFgknq52mJowlixe6gAADs=);font-size:0;position:absolute}.jcrop-vline{height:100%;width:1px!important}.jcrop-vline.right{right:0}.jcrop-hline{height:1px!important;width:100%}.jcrop-hline.bottom{bottom:0}.jcrop-tracker{-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;height:100%;width:100%}.jcrop-handle{background-color:#333;border:1px solid #eee;font-size:1px;height:7px;width:7px}.jcrop-handle.ord-n{left:50%;margin-left:-4px;margin-top:-4px;top:0}.jcrop-handle.ord-s{bottom:0;left:50%;margin-bottom:-4px;margin-left:-4px}.jcrop-handle.ord-e{margin-right:-4px;margin-top:-4px;right:0;top:50%}.jcrop-handle.ord-w{left:0;margin-left:-4px;margin-top:-4px;top:50%}.jcrop-handle.ord-nw{left:0;margin-left:-4px;margin-top:-4px;top:0}.jcrop-handle.ord-ne{margin-right:-4px;margin-top:-4px;right:0;top:0}.jcrop-handle.ord-se{bottom:0;margin-bottom:-4px;margin-right:-4px;right:0}.jcrop-handle.ord-sw{bottom:0;left:0;margin-bottom:-4px;margin-left:-4px}.jcrop-dragbar.ord-n,.jcrop-dragbar.ord-s{height:7px;width:100%}.jcrop-dragbar.ord-e,.jcrop-dragbar.ord-w{height:100%;width:7px}.jcrop-dragbar.ord-n{margin-top:-4px}.jcrop-dragbar.ord-s{bottom:0;margin-bottom:-4px}.jcrop-dragbar.ord-e{margin-right:-4px;right:0}.jcrop-dragbar.ord-w{margin-left:-4px}.jcrop-light .jcrop-hline,.jcrop-light .jcrop-vline{background:#fff;filter:alpha(opacity=70)!important;opacity:.7!important}.jcrop-light .jcrop-handle{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#000;border-color:#fff;border-radius:3px}.jcrop-dark .jcrop-hline,.jcrop-dark .jcrop-vline{background:#000;filter:alpha(opacity=70)!important;opacity:.7!important}.jcrop-dark .jcrop-handle{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#fff;border-color:#000;border-radius:3px}.solid-line .jcrop-hline,.solid-line .jcrop-vline{background:#fff}.jcrop-holder img,img.jcrop-preview{max-width:none}div.jcrop-image.size-warning .jcrop-hline,div.jcrop-image.size-warning .jcrop-vline{border:1px solid red;background:none}body.change-form .allow-fullsize+.help,body.change-form .jcrop-holder+.help{clear:left}body.change-form .jcrop-holder{float:left}div.allow-fullsize{padding:5px 0 0 10px}

2516
sapl/static/js/chunk-vendors.962fb9e0.js

File diff suppressed because one or more lines are too long

240
sapl/static/js/compilacao.196359a8.js

File diff suppressed because one or more lines are too long

316
sapl/static/js/global.32642276.js

File diff suppressed because one or more lines are too long

195
sapl/static/js/image_cropping.c0e3598f.js

File diff suppressed because one or more lines are too long

14
sapl/static/js/jquery_mask_plugin.8c657459.js

File diff suppressed because one or more lines are too long

27
sapl/templates/base.html

@ -18,12 +18,10 @@
{% block webpack_loader_css %} {% block webpack_loader_css %}
{% render_bundle 'chunk-vendors' 'css' %} {% render_bundle 'chunk-vendors' 'css' %}
{% render_bundle 'global' 'css' %} {% render_bundle 'global' 'css' %}
{% render_bundle THEME_CUSTOM 'css' %}
{% endblock webpack_loader_css %} {% endblock webpack_loader_css %}
{% block webpack_loader_chunks_css %} {% block webpack_loader_chunks_css %}
{% render_bundle 'image_cropping' 'css' %} {% render_bundle THEME_CUSTOM 'css' %}
{% render_bundle 'jquery_mask_plugin' 'css' %}
{% endblock webpack_loader_chunks_css %} {% endblock webpack_loader_chunks_css %}
{% endblock %} {% endblock %}
@ -231,31 +229,10 @@
{% block webpack_loader_js %} {% block webpack_loader_js %}
{% render_bundle 'chunk-vendors' 'js' %} {% render_bundle 'chunk-vendors' 'js' %}
{% render_bundle 'global' 'js' %} {% render_bundle 'global' 'js' %}
{% render_bundle THEME_CUSTOM 'js' %}
{% endblock webpack_loader_js %} {% endblock webpack_loader_js %}
{% block webpack_loader_chunks_js %} {% block webpack_loader_chunks_js %}
{% comment %} {% render_bundle THEME_CUSTOM 'js' %}
Code Spliting -
O Split Chunks são catalogados no arquivo webpack-stats.json
Seria mais eficiente importar o que criado (arbitrariamente separado)
apenas nos locais que são necessários e aqui em base.html
este bloco ficar vazio para extensão quando necessário.
Anteriormente tudo já era importado aqui no base.html, só que
agora podemos reverter isso refatorando os templates
e importando apenas o que for necessário, onde for.
Ou seja:
- ou carrega tudo aqui em base.html e, "se quiser",
remove em qualquer html de extensão como foi feito em index.html
- ou não carrega nenhum Chunk aqui e carrega apenas onde for necessário
- image_cropping, por exemplo, seu js só é usado na edição de parlamentares e
poderia ser importado apenas nesta tela
- jquery_mask_plugin só é usado em telas de formulários...
{% endcomment %}
{% render_bundle 'image_cropping' 'js' %}
{% render_bundle 'jquery_mask_plugin' 'js' %}
{% endblock webpack_loader_chunks_js %} {% endblock webpack_loader_chunks_js %}
{% block extra_js %}{% endblock %} {% block extra_js %}{% endblock %}

8
sapl/templates/compilacao/base_compilacao.html

@ -3,13 +3,11 @@
{% load render_bundle from webpack_loader %} {% load render_bundle from webpack_loader %}
{% block webpack_loader_css %} {% block webpack_loader_css %}
{% render_bundle 'global' 'css' %} {{ block.super }}
{% render_bundle 'compilacao' 'css' %} {% render_bundle 'compilacao' 'css' %}
{% render_bundle THEME_CUSTOM 'css' %}
{% endblock %} {% endblock %}
{% block webpack_loader_js %} {% block webpack_loader_js %}
{% render_bundle 'global' 'js' %} {{ block.super }}
{% render_bundle 'compilacao' 'js' %} {% render_bundle 'compilacao' 'js' %}
{% render_bundle THEME_CUSTOM 'js' %}
{% endblock %} {% endblock %}

12
sapl/templates/norma/normajuridica_detail.html

@ -3,11 +3,10 @@
{% load render_bundle from webpack_loader %} {% load render_bundle from webpack_loader %}
{% block webpack_loader_css %} {% block webpack_loader_css %}
{% render_bundle 'global' 'css' %} {{ block.super }}
{% if object.texto_articulado.exists and object.texto_articulado.first.has_view_permission %} {% if object.texto_articulado.exists and object.texto_articulado.first.has_view_permission %}
{% render_bundle 'compilacao' 'css' %} {% render_bundle 'compilacao' 'css' %}
{% endif %} {% endif %}
{% render_bundle THEME_CUSTOM 'css' %}
{% endblock %} {% endblock %}
@ -102,11 +101,10 @@
{% block webpack_loader_js %} {% block webpack_loader_js %}
{% render_bundle 'global' 'js' %} {{ block.super }}
{% if object.texto_articulado.exists and object.texto_articulado.first.has_view_permission %} {% if object.texto_articulado.exists and object.texto_articulado.first.has_view_permission %}
{% render_bundle 'compilacao' 'js' %} {% render_bundle 'compilacao' 'js' %}
{% endif %} {% endif %}
{% render_bundle THEME_CUSTOM 'js' %}
{% endblock %} {% endblock %}

2
webpack-stats.json

@ -1 +1 @@
{"status":"done","publicPath":"/static/","chunks":{"chunk-vendors":[{"name":"css/chunk-vendors.7ccaa4c3.css","publicPath":"/static/css/chunk-vendors.7ccaa4c3.css","path":"../sapl/static/css/chunk-vendors.7ccaa4c3.css"},{"name":"js/chunk-vendors.962fb9e0.js","publicPath":"/static/js/chunk-vendors.962fb9e0.js","path":"../sapl/static/js/chunk-vendors.962fb9e0.js"}],"compilacao":[{"name":"css/compilacao.8f6b7cdb.css","publicPath":"/static/css/compilacao.8f6b7cdb.css","path":"../sapl/static/css/compilacao.8f6b7cdb.css"},{"name":"js/compilacao.196359a8.js","publicPath":"/static/js/compilacao.196359a8.js","path":"../sapl/static/js/compilacao.196359a8.js"}],"global":[{"name":"js/global.32642276.js","publicPath":"/static/js/global.32642276.js","path":"../sapl/static/js/global.32642276.js"}],"image_cropping":[{"name":"css/image_cropping.8608d5e7.css","publicPath":"/static/css/image_cropping.8608d5e7.css","path":"../sapl/static/css/image_cropping.8608d5e7.css"},{"name":"js/image_cropping.c0e3598f.js","publicPath":"/static/js/image_cropping.c0e3598f.js","path":"../sapl/static/js/image_cropping.c0e3598f.js"}],"jquery_mask_plugin":[{"name":"js/jquery_mask_plugin.8c657459.js","publicPath":"/static/js/jquery_mask_plugin.8c657459.js","path":"../sapl/static/js/jquery_mask_plugin.8c657459.js"}],"sapl-oficial-theme":[{"name":"js/sapl-oficial-theme.391f1e2f.js","publicPath":"/static/js/sapl-oficial-theme.391f1e2f.js","path":"../sapl/static/js/sapl-oficial-theme.391f1e2f.js"}]}} {"status":"done","publicPath":"/static/","chunks":{"chunk-vendors":[{"name":"css/chunk-vendors.7ccaa4c3.css","publicPath":"/static/css/chunk-vendors.7ccaa4c3.css","path":"../sapl/static/css/chunk-vendors.7ccaa4c3.css"},{"name":"js/chunk-vendors.e63ea81d.js","publicPath":"/static/js/chunk-vendors.e63ea81d.js","path":"../sapl/static/js/chunk-vendors.e63ea81d.js"}],"compilacao":[{"name":"css/compilacao.8f6b7cdb.css","publicPath":"/static/css/compilacao.8f6b7cdb.css","path":"../sapl/static/css/compilacao.8f6b7cdb.css"},{"name":"js/compilacao.5ddb3dc9.js","publicPath":"/static/js/compilacao.5ddb3dc9.js","path":"../sapl/static/js/compilacao.5ddb3dc9.js"}],"global":[{"name":"css/global.8608d5e7.css","publicPath":"/static/css/global.8608d5e7.css","path":"../sapl/static/css/global.8608d5e7.css"},{"name":"js/global.f4c03912.js","publicPath":"/static/js/global.f4c03912.js","path":"../sapl/static/js/global.f4c03912.js"}],"sapl-oficial-theme":[{"name":"js/sapl-oficial-theme.391f1e2f.js","publicPath":"/static/js/sapl-oficial-theme.391f1e2f.js","path":"../sapl/static/js/sapl-oficial-theme.391f1e2f.js"}]}}
Loading…
Cancel
Save