##// END OF EJS Templates
js: support shared styles via webpack inline
ergo -
r3179:0e268a0f default
parent child Browse files
Show More
@@ -0,0 +1,11 b''
1 const styleElement = document.createElement('dom-module');
2 import sharedCSS from 'raw-loader!./style-polymer.css';
3
4 styleElement.innerHTML =
5 `<template>
6 <style>
7 ${sharedCSS}
8 </style>
9 </template>`;
10
11 styleElement.register('shared-styles');
@@ -1,21 +1,21 b''
1 var gruntConfig = require('./grunt_config.json');
1 var gruntConfig = require('./grunt_config.json');
2 var webpackConfig = require('./webpack.config');
2 var webpackConfig = require('./webpack.config');
3 gruntConfig["webpack"] = {
3 gruntConfig["webpack"] = {
4 options: {
4 options: {
5 stats: !process.env.NODE_ENV || process.env.NODE_ENV === 'development'
5 stats: !process.env.NODE_ENV || process.env.NODE_ENV === 'development'
6 },
6 },
7 prod: webpackConfig,
7 prod: webpackConfig,
8 dev: Object.assign({ watch: false }, webpackConfig)
8 dev: Object.assign({ watch: false }, webpackConfig)
9 };
9 };
10
10
11 module.exports = function(grunt) {
11 module.exports = function(grunt) {
12 grunt.initConfig(gruntConfig);
12 grunt.initConfig(gruntConfig);
13
13
14 grunt.loadNpmTasks('grunt-contrib-less');
14 grunt.loadNpmTasks('grunt-contrib-less');
15 grunt.loadNpmTasks('grunt-contrib-concat');
15 grunt.loadNpmTasks('grunt-contrib-concat');
16 grunt.loadNpmTasks('grunt-contrib-watch');
16 grunt.loadNpmTasks('grunt-contrib-watch');
17 grunt.loadNpmTasks('grunt-contrib-jshint');
17 grunt.loadNpmTasks('grunt-contrib-jshint');
18 grunt.loadNpmTasks('grunt-contrib-copy');
18 grunt.loadNpmTasks('grunt-contrib-copy');
19 grunt.loadNpmTasks('grunt-webpack');
19 grunt.loadNpmTasks('grunt-webpack');
20 grunt.registerTask('default', ['less:production', 'less:components', 'concat:polymercss', 'copy', 'webpack', 'concat:dist']);
20 grunt.registerTask('default', ['less:production', 'less:components', 'copy', 'webpack', 'concat:dist']);
21 };
21 };
@@ -1,175 +1,174 b''
1 {
1 {
2 "dirs": {
2 "dirs": {
3 "css": {
3 "css": {
4 "src":"rhodecode/public/css",
4 "src": "rhodecode/public/css",
5 "dest":"rhodecode/public/css"
5 "dest": "rhodecode/public/css"
6 },
6 },
7 "js": {
7 "js": {
8 "src": "rhodecode/public/js/src",
8 "src": "rhodecode/public/js/src",
9 "src_rc": "rhodecode/public/js/rhodecode",
9 "src_rc": "rhodecode/public/js/rhodecode",
10 "dest": "rhodecode/public/js",
10 "dest": "rhodecode/public/js",
11 "node_modules": "node_modules"
11 "node_modules": "node_modules"
12 }
12 }
13 },
13 },
14 "copy": {
14 "copy": {
15 "main": {
15 "main": {
16 "expand": true,
16 "files": [
17 "cwd": "node_modules/@webcomponents",
17 {
18 "src": "webcomponentsjs/*.*",
18 "expand": true,
19 "dest": "<%= dirs.js.dest %>/vendors"
19 "cwd": "node_modules/@webcomponents",
20 "src": "webcomponentsjs/*.*",
21 "dest": "<%= dirs.js.dest %>/vendors"
22 },
23 {
24 "src": "<%= dirs.css.src %>/style-polymer.css",
25 "dest": "<%= dirs.js.dest %>/src/components/style-polymer.css"
26 }
27 ]
20 }
28 }
21 },
29 },
22 "concat": {
30 "concat": {
23 "polymercss": {
24 "src": [
25 "<%= dirs.js.src %>/components/root-styles-prefix.html",
26 "<%= dirs.css.src %>/style-polymer.css",
27 "<%= dirs.js.src %>/components/root-styles-suffix.html"
28 ],
29 "dest": "<%= dirs.js.dest %>/src/components/root-styles.gen.html",
30 "nonull": true
31 },
32 "dist": {
31 "dist": {
33 "src": [
32 "src": [
34 "<%= dirs.js.node_modules %>/jquery/dist/jquery.min.js",
33 "<%= dirs.js.node_modules %>/jquery/dist/jquery.min.js",
35 "<%= dirs.js.node_modules %>/mousetrap/mousetrap.min.js",
34 "<%= dirs.js.node_modules %>/mousetrap/mousetrap.min.js",
36 "<%= dirs.js.node_modules %>/moment/min/moment.min.js",
35 "<%= dirs.js.node_modules %>/moment/min/moment.min.js",
37 "<%= dirs.js.node_modules %>/clipboard/dist/clipboard.min.js",
36 "<%= dirs.js.node_modules %>/clipboard/dist/clipboard.min.js",
38 "<%= dirs.js.node_modules %>/favico.js/favico-0.3.10.min.js",
37 "<%= dirs.js.node_modules %>/favico.js/favico-0.3.10.min.js",
39 "<%= dirs.js.node_modules %>/sticky-sidebar/dist/sticky-sidebar.min.js",
38 "<%= dirs.js.node_modules %>/sticky-sidebar/dist/sticky-sidebar.min.js",
40 "<%= dirs.js.node_modules %>/sticky-sidebar/dist/jquery.sticky-sidebar.min.js",
39 "<%= dirs.js.node_modules %>/sticky-sidebar/dist/jquery.sticky-sidebar.min.js",
41 "<%= dirs.js.node_modules %>/waypoints/lib/noframework.waypoints.min.js",
40 "<%= dirs.js.node_modules %>/waypoints/lib/noframework.waypoints.min.js",
42 "<%= dirs.js.node_modules %>/waypoints/lib/jquery.waypoints.min.js",
41 "<%= dirs.js.node_modules %>/waypoints/lib/jquery.waypoints.min.js",
43 "<%= dirs.js.node_modules %>/appenlight-client/appenlight-client.min.js",
42 "<%= dirs.js.node_modules %>/appenlight-client/appenlight-client.min.js",
44 "<%= dirs.js.src %>/logging.js",
43 "<%= dirs.js.src %>/logging.js",
45 "<%= dirs.js.src %>/bootstrap.js",
44 "<%= dirs.js.src %>/bootstrap.js",
46 "<%= dirs.js.src %>/i18n_utils.js",
45 "<%= dirs.js.src %>/i18n_utils.js",
47 "<%= dirs.js.src %>/deform.js",
46 "<%= dirs.js.src %>/deform.js",
48 "<%= dirs.js.src %>/ejs.js",
47 "<%= dirs.js.src %>/ejs.js",
49 "<%= dirs.js.src %>/ejs_templates/utils.js",
48 "<%= dirs.js.src %>/ejs_templates/utils.js",
50 "<%= dirs.js.src %>/plugins/jquery.pjax.js",
49 "<%= dirs.js.src %>/plugins/jquery.pjax.js",
51 "<%= dirs.js.src %>/plugins/jquery.dataTables.js",
50 "<%= dirs.js.src %>/plugins/jquery.dataTables.js",
52 "<%= dirs.js.src %>/plugins/flavoured_checkbox.js",
51 "<%= dirs.js.src %>/plugins/flavoured_checkbox.js",
53 "<%= dirs.js.src %>/plugins/jquery.auto-grow-input.js",
52 "<%= dirs.js.src %>/plugins/jquery.auto-grow-input.js",
54 "<%= dirs.js.src %>/plugins/jquery.autocomplete.js",
53 "<%= dirs.js.src %>/plugins/jquery.autocomplete.js",
55 "<%= dirs.js.src %>/plugins/jquery.debounce.js",
54 "<%= dirs.js.src %>/plugins/jquery.debounce.js",
56 "<%= dirs.js.src %>/plugins/jquery.mark.js",
55 "<%= dirs.js.src %>/plugins/jquery.mark.js",
57 "<%= dirs.js.src %>/plugins/jquery.timeago.js",
56 "<%= dirs.js.src %>/plugins/jquery.timeago.js",
58 "<%= dirs.js.src %>/plugins/jquery.timeago-extension.js",
57 "<%= dirs.js.src %>/plugins/jquery.timeago-extension.js",
59 "<%= dirs.js.src %>/select2/select2.js",
58 "<%= dirs.js.src %>/select2/select2.js",
60 "<%= dirs.js.src %>/codemirror/codemirror.js",
59 "<%= dirs.js.src %>/codemirror/codemirror.js",
61 "<%= dirs.js.src %>/codemirror/codemirror_loadmode.js",
60 "<%= dirs.js.src %>/codemirror/codemirror_loadmode.js",
62 "<%= dirs.js.src %>/codemirror/codemirror_hint.js",
61 "<%= dirs.js.src %>/codemirror/codemirror_hint.js",
63 "<%= dirs.js.src %>/codemirror/codemirror_overlay.js",
62 "<%= dirs.js.src %>/codemirror/codemirror_overlay.js",
64 "<%= dirs.js.src %>/codemirror/codemirror_placeholder.js",
63 "<%= dirs.js.src %>/codemirror/codemirror_placeholder.js",
65 "<%= dirs.js.src %>/codemirror/codemirror_simplemode.js",
64 "<%= dirs.js.src %>/codemirror/codemirror_simplemode.js",
66 "<%= dirs.js.dest %>/mode/meta.js",
65 "<%= dirs.js.dest %>/mode/meta.js",
67 "<%= dirs.js.dest %>/mode/meta_ext.js",
66 "<%= dirs.js.dest %>/mode/meta_ext.js",
68 "<%= dirs.js.src_rc %>/i18n/select2/translations.js",
67 "<%= dirs.js.src_rc %>/i18n/select2/translations.js",
69 "<%= dirs.js.src %>/rhodecode/utils/array.js",
68 "<%= dirs.js.src %>/rhodecode/utils/array.js",
70 "<%= dirs.js.src %>/rhodecode/utils/string.js",
69 "<%= dirs.js.src %>/rhodecode/utils/string.js",
71 "<%= dirs.js.src %>/rhodecode/utils/pyroutes.js",
70 "<%= dirs.js.src %>/rhodecode/utils/pyroutes.js",
72 "<%= dirs.js.src %>/rhodecode/utils/ajax.js",
71 "<%= dirs.js.src %>/rhodecode/utils/ajax.js",
73 "<%= dirs.js.src %>/rhodecode/utils/autocomplete.js",
72 "<%= dirs.js.src %>/rhodecode/utils/autocomplete.js",
74 "<%= dirs.js.src %>/rhodecode/utils/colorgenerator.js",
73 "<%= dirs.js.src %>/rhodecode/utils/colorgenerator.js",
75 "<%= dirs.js.src %>/rhodecode/utils/ie.js",
74 "<%= dirs.js.src %>/rhodecode/utils/ie.js",
76 "<%= dirs.js.src %>/rhodecode/utils/os.js",
75 "<%= dirs.js.src %>/rhodecode/utils/os.js",
77 "<%= dirs.js.src %>/rhodecode/utils/topics.js",
76 "<%= dirs.js.src %>/rhodecode/utils/topics.js",
78 "<%= dirs.js.src %>/rhodecode/init.js",
77 "<%= dirs.js.src %>/rhodecode/init.js",
79 "<%= dirs.js.src %>/rhodecode/changelog.js",
78 "<%= dirs.js.src %>/rhodecode/changelog.js",
80 "<%= dirs.js.src %>/rhodecode/codemirror.js",
79 "<%= dirs.js.src %>/rhodecode/codemirror.js",
81 "<%= dirs.js.src %>/rhodecode/comments.js",
80 "<%= dirs.js.src %>/rhodecode/comments.js",
82 "<%= dirs.js.src %>/rhodecode/constants.js",
81 "<%= dirs.js.src %>/rhodecode/constants.js",
83 "<%= dirs.js.src %>/rhodecode/files.js",
82 "<%= dirs.js.src %>/rhodecode/files.js",
84 "<%= dirs.js.src %>/rhodecode/followers.js",
83 "<%= dirs.js.src %>/rhodecode/followers.js",
85 "<%= dirs.js.src %>/rhodecode/menus.js",
84 "<%= dirs.js.src %>/rhodecode/menus.js",
86 "<%= dirs.js.src %>/rhodecode/notifications.js",
85 "<%= dirs.js.src %>/rhodecode/notifications.js",
87 "<%= dirs.js.src %>/rhodecode/permissions.js",
86 "<%= dirs.js.src %>/rhodecode/permissions.js",
88 "<%= dirs.js.src %>/rhodecode/pjax.js",
87 "<%= dirs.js.src %>/rhodecode/pjax.js",
89 "<%= dirs.js.src %>/rhodecode/pullrequests.js",
88 "<%= dirs.js.src %>/rhodecode/pullrequests.js",
90 "<%= dirs.js.src %>/rhodecode/settings.js",
89 "<%= dirs.js.src %>/rhodecode/settings.js",
91 "<%= dirs.js.src %>/rhodecode/select2_widgets.js",
90 "<%= dirs.js.src %>/rhodecode/select2_widgets.js",
92 "<%= dirs.js.src %>/rhodecode/tooltips.js",
91 "<%= dirs.js.src %>/rhodecode/tooltips.js",
93 "<%= dirs.js.src %>/rhodecode/users.js",
92 "<%= dirs.js.src %>/rhodecode/users.js",
94 "<%= dirs.js.src %>/rhodecode/appenlight.js",
93 "<%= dirs.js.src %>/rhodecode/appenlight.js",
95 "<%= dirs.js.src %>/rhodecode.js",
94 "<%= dirs.js.src %>/rhodecode.js",
96 "<%= dirs.js.dest %>/rhodecode-components.js"
95 "<%= dirs.js.dest %>/rhodecode-components.js"
97 ],
96 ],
98 "dest": "<%= dirs.js.dest %>/scripts.js",
97 "dest": "<%= dirs.js.dest %>/scripts.js",
99 "nonull": true
98 "nonull": true
100 }
99 }
101 },
100 },
102 "less": {
101 "less": {
103 "development": {
102 "development": {
104 "options": {
103 "options": {
105 "compress": false,
104 "compress": false,
106 "yuicompress": false,
105 "yuicompress": false,
107 "optimization": 0
106 "optimization": 0
108 },
107 },
109 "files": {
108 "files": {
110 "<%= dirs.css.dest %>/style.css": "<%= dirs.css.src %>/main.less",
109 "<%= dirs.css.dest %>/style.css": "<%= dirs.css.src %>/main.less",
111 "<%= dirs.css.dest %>/style-polymer.css": "<%= dirs.css.src %>/polymer.less"
110 "<%= dirs.css.dest %>/style-polymer.css": "<%= dirs.css.src %>/polymer.less"
112 }
111 }
113 },
112 },
114 "production": {
113 "production": {
115 "options": {
114 "options": {
116 "compress": true,
115 "compress": true,
117 "yuicompress": true,
116 "yuicompress": true,
118 "optimization": 2
117 "optimization": 2
119 },
118 },
120 "files": {
119 "files": {
121 "<%= dirs.css.dest %>/style.css": "<%= dirs.css.src %>/main.less",
120 "<%= dirs.css.dest %>/style.css": "<%= dirs.css.src %>/main.less",
122 "<%= dirs.css.dest %>/style-polymer.css": "<%= dirs.css.src %>/polymer.less"
121 "<%= dirs.css.dest %>/style-polymer.css": "<%= dirs.css.src %>/polymer.less"
123 }
122 }
124 },
123 },
125 "components": {
124 "components": {
126 "files": [
125 "files": [
127 {
126 {
128 "cwd": "<%= dirs.js.src %>/components/",
127 "cwd": "<%= dirs.js.src %>/components/",
129 "dest": "<%= dirs.js.src %>/components/",
128 "dest": "<%= dirs.js.src %>/components/",
130 "src": [
129 "src": [
131 "**/*.less"
130 "**/*.less"
132 ],
131 ],
133 "expand": true,
132 "expand": true,
134 "ext": ".css"
133 "ext": ".css"
135 }
134 }
136 ]
135 ]
137 }
136 }
138 },
137 },
139 "watch": {
138 "watch": {
140 "less": {
139 "less": {
141 "files": [
140 "files": [
142 "<%= dirs.css.src %>/**/*.less",
141 "<%= dirs.css.src %>/**/*.less",
143 "<%= dirs.js.src %>/components/**/*.less"
142 "<%= dirs.js.src %>/components/**/*.less"
144 ],
143 ],
145 "tasks": [
144 "tasks": [
146 "less:development",
145 "less:development",
147 "less:components",
146 "less:components",
148 "concat:polymercss",
147 "concat:polymercss",
149 "webpack",
148 "webpack",
150 "concat:dist"
149 "concat:dist"
151 ]
150 ]
152 },
151 },
153 "js": {
152 "js": {
154 "files": [
153 "files": [
155 "!<%= dirs.js.src %>/components/root-styles.gen.html",
154 "!<%= dirs.js.src %>/components/root-styles.gen.html",
156 "<%= dirs.js.src %>/**/*.js",
155 "<%= dirs.js.src %>/**/*.js",
157 "<%= dirs.js.src %>/components/**/*.html"
156 "<%= dirs.js.src %>/components/**/*.html"
158 ],
157 ],
159 "tasks": [
158 "tasks": [
160 "less:components",
159 "less:components",
161 "concat:polymercss",
160 "concat:polymercss",
162 "webpack",
161 "webpack",
163 "concat:dist"
162 "concat:dist"
164 ]
163 ]
165 }
164 }
166 },
165 },
167 "jshint": {
166 "jshint": {
168 "rhodecode": {
167 "rhodecode": {
169 "src": "<%= dirs.js.src %>/rhodecode/**/*.js",
168 "src": "<%= dirs.js.src %>/rhodecode/**/*.js",
170 "options": {
169 "options": {
171 "jshintrc": ".jshintrc"
170 "jshintrc": ".jshintrc"
172 }
171 }
173 }
172 }
174 }
173 }
175 }
174 }
@@ -1,7 +1,7 b''
1 import '@polymer/iron-ajax/iron-ajax.js';
1 import '@polymer/iron-ajax/iron-ajax.js';
2 import './root-styles.gen.html';
2 import './shared-styles.js';
3 import './channelstream-connection/channelstream-connection.js';
3 import './channelstream-connection/channelstream-connection.js';
4 import './rhodecode-toast/rhodecode-toast.js';
4 import './rhodecode-toast/rhodecode-toast.js';
5 import './rhodecode-toggle/rhodecode-toggle.js';
5 import './rhodecode-toggle/rhodecode-toggle.js';
6 import './rhodecode-unsafe-html/rhodecode-unsafe-html.js';
6 import './rhodecode-unsafe-html/rhodecode-unsafe-html.js';
7 import './rhodecode-app/rhodecode-app.js';
7 import './rhodecode-app/rhodecode-app.js';
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now