##// END OF EJS Templates
grunt: separate js from web components
ergo -
r730:08b9b215 default
parent child Browse files
Show More
@@ -98,15 +98,23 b' module.exports = function(grunt) {'
98 98 '<%= dirs.js.src %>/rhodecode/users.js',
99 99 '<%= dirs.js.src %>/rhodecode/utils/notifications.js',
100 100 '<%= dirs.js.src %>/rhodecode/appenlight.js',
101
102 101 // Rhodecode main module
103 '<%= dirs.js.src %>/rhodecode.js'
102 '<%= dirs.js.src %>/rhodecode.js',
104 103 ],
105 104 dest: '<%= dirs.js.dest %>/scripts.js',
106 105 nonull: true
107 106 }
108 107 },
109
108 crisper: {
109 dist: {
110 options: {
111 cleanup: false,
112 onlySplit: true
113 },
114 src: '<%= dirs.js.dest %>/rhodecode-components.html',
115 dest: '<%= dirs.js.dest %>/rhodecode-components.js'
116 }
117 },
110 118 less: {
111 119 development: {
112 120 options: {
@@ -148,7 +156,7 b' module.exports = function(grunt) {'
148 156 },
149 157 js: {
150 158 files: ["<%= dirs.js.src %>/**/*.js", "<%= dirs.js.src %>/components/**/*.html"],
151 tasks: ['less:components', 'concat:polymercss', "vulcanize", "concat:dist"]
159 tasks: ['less:components', 'concat:polymercss', "vulcanize", 'crisper', "concat:dist"]
152 160 }
153 161 },
154 162
@@ -183,5 +191,5 b' module.exports = function(grunt) {'
183 191 grunt.loadNpmTasks('grunt-crisper');
184 192 grunt.loadNpmTasks('grunt-contrib-copy');
185 193
186 grunt.registerTask('default', ['less:production', 'less:components', 'concat:polymercss', 'copy','vulcanize', 'concat:dist']);
194 grunt.registerTask('default', ['less:production', 'less:components', 'concat:polymercss', 'copy','vulcanize', 'crisper', 'concat:dist']);
187 195 };
@@ -46,17 +46,30 b" c.template_context['visual']['default_re"
46 46 // setup Polymer options
47 47 window.Polymer = {lazyRegister: true, dom: 'shadow'};
48 48
49 // load webcomponents polyfills
49 // Load webcomponentsjs polyfill if browser does not support native Web Components
50 50 (function() {
51 if ('registerElement' in document
51 'use strict';
52 var onload = function() {
53 // For native Imports, manually fire WebComponentsReady so user code
54 // can use the same code path for native and polyfill'd imports.
55 if (!window.HTMLImports) {
56 document.dispatchEvent(
57 new CustomEvent('WebComponentsReady', {bubbles: true})
58 );
59 }
60 };
61 var webComponentsSupported = (
62 'registerElement' in document
52 63 && 'import' in document.createElement('link')
53 && 'content' in document.createElement('template')) {
54 // browser has web components
55 } else {
56 // polyfill web components
64 && 'content' in document.createElement('template')
65 );
66 if (!webComponentsSupported) {
57 67 var e = document.createElement('script');
68 e.async = true;
58 69 e.src = '${h.asset('js/vendors/webcomponentsjs/webcomponents-lite.min.js', ver=c.rhodecode_version_hash)}';
59 70 document.head.appendChild(e);
71 } else {
72 onload();
60 73 }
61 74 })();
62 75 </script>
@@ -103,6 +116,11 b" c.template_context['visual']['default_re"
103 116 <![endif]-->
104 117 <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script>
105 118 <script language="javascript" type="text/javascript" src="${h.asset('js/scripts.js', ver=c.rhodecode_version_hash)}"></script>
119 <script>
120 var e = document.createElement('script');
121 e.src = '${h.asset('js/rhodecode-components.js', ver=c.rhodecode_version_hash)}';
122 document.head.appendChild(e);
123 </script>
106 124 <link rel="import" href="${h.asset('js/rhodecode-components.html', ver=c.rhodecode_version_hash)}">
107 125 <style include="shared-styles" is="custom-style"></style>
108 126 ## avoide escaping the %N
General Comments 0
You need to be logged in to leave comments. Login now