|
15 | 15 | concat = require('gulp-concat'),
|
16 | 16 | jshint = require('gulp-jshint'),
|
17 | 17 | stylish = require('jshint-stylish'),
|
| 18 | + rollup = require('rollup-stream'), |
| 19 | + buble = require('rollup-plugin-buble'), |
| 20 | + source = require('vinyl-source-stream'), |
| 21 | + buffer = require('vinyl-buffer'), |
18 | 22 | fs = require('fs'),
|
19 | 23 | paths = {
|
20 | 24 | root: './',
|
|
63 | 67 | f7 = {
|
64 | 68 | filename: 'framework7',
|
65 | 69 | jsFiles: [
|
66 |
| - './node_modules/dom7/dist/dom7.js', |
67 |
| - './node_modules/template7/dist/template7.js', |
| 70 | + 'src/js/dom7/dom7.js', |
| 71 | + 'src/js/template7/template7.js', |
68 | 72 | 'src/js/wrap-start.js',
|
69 | 73 | 'src/js/framework7/f7-intro.js',
|
70 | 74 | 'src/js/framework7/views.js',
|
|
164 | 168 | function addJSIndent (file, t) {
|
165 | 169 | var addIndent = ' ';
|
166 | 170 | var filename = file.path.split('src/js/')[1];
|
167 |
| - if (filename === 'wrap-start.js' || filename === 'wrap-end.js' || !filename) { |
| 171 | + if (filename === 'wrap-start.js' || filename === 'wrap-end.js' || filename === 'dom7/dom7.js' || filename === 'template7/template7.js') { |
168 | 172 | addIndent = '';
|
169 | 173 | }
|
170 |
| - var add4spaces = ('framework7/f7-intro.js framework7/f7-outro.js framework7/proto-device.js framework7/proto-plugins.js framework7/proto-support.js dom7/dom7-intro.js dom7/dom7-outro.js animate7/animate7.js template7/template7.js swiper/swiper.js').split(' '); |
| 174 | + var add4spaces = ('framework7/f7-intro.js framework7/f7-outro.js framework7/proto-device.js framework7/proto-plugins.js framework7/proto-support.js swiper/swiper.js').split(' '); |
171 | 175 | if (add4spaces.indexOf(filename) >= 0) {
|
172 | 176 | addIndent = ' ';
|
173 | 177 | }
|
174 |
| - var add8spaces = ('dom7/dom7-methods.js dom7/dom7-ajax.js dom7/dom7-utils.js').split(' '); |
175 |
| - if (add8spaces.indexOf(filename) >= 0) { |
176 |
| - addIndent = ' '; |
177 |
| - } |
| 178 | + // var add8spaces = ('dom7/dom7-methods.js dom7/dom7-ajax.js dom7/dom7-utils.js').split(' '); |
| 179 | + // if (add8spaces.indexOf(filename) >= 0) { |
| 180 | + // addIndent = ' '; |
| 181 | + // } |
178 | 182 | if (addIndent !== '') {
|
179 | 183 | var fileLines = fs.readFileSync(file.path).toString().split('\n');
|
180 | 184 | var newFileContents = '';
|
|
187 | 191 | /* ==================================================================
|
188 | 192 | Build Framework7
|
189 | 193 | ================================================================== */
|
| 194 | + gulp.task('dom7', function (cb) { |
| 195 | + rollup({ |
| 196 | + entry: './node_modules/dom7/src/dom7.js', |
| 197 | + plugins: [buble()], |
| 198 | + format: 'iife', |
| 199 | + moduleName: 'Dom7', |
| 200 | + useStrict: true, |
| 201 | + }) |
| 202 | + .pipe(source('dom7.js', './node_modules/dom7/src')) |
| 203 | + .pipe(buffer()) |
| 204 | + .pipe(gulp.dest('./src/js/dom7/')) |
| 205 | + .on('end', function () { |
| 206 | + var fileContent = fs.readFileSync('./src/js/dom7/dom7.js', 'utf-8'); |
| 207 | + fs.writeFileSync('./src/js/dom7/dom7.js', fileContent.replace('var Dom7 = (function () {', 'window.Dom7 = (function () {')) |
| 208 | + cb(); |
| 209 | + }); |
| 210 | + }); |
| 211 | + gulp.task('template7', function (cb) { |
| 212 | + rollup({ |
| 213 | + entry: './node_modules/template7/src/template7.js', |
| 214 | + plugins: [buble()], |
| 215 | + format: 'iife', |
| 216 | + moduleName: 'Template7', |
| 217 | + useStrict: true, |
| 218 | + }) |
| 219 | + .pipe(source('template7.js', './node_modules/template7/src')) |
| 220 | + .pipe(buffer()) |
| 221 | + .pipe(gulp.dest('./src/js/template7/')) |
| 222 | + .on('end', function () { |
| 223 | + var fileContent = fs.readFileSync('./src/js/template7/template7.js', 'utf-8'); |
| 224 | + fs.writeFileSync('./src/js/template7/template7.js', fileContent.replace('var Template7 = (function () {', 'window.Template7 = (function () {')) |
| 225 | + cb(); |
| 226 | + }); |
| 227 | + }); |
190 | 228 | // Build Styles and Scripts
|
191 | 229 | gulp.task('scripts', function (cb) {
|
192 | 230 | gulp.src(f7.jsFiles)
|
|
0 commit comments