View | Details | Raw Unified | Return to bug 15522
Collapse All | Expand All

(-)a/.gitignore (+1 lines)
Lines 5-7 Link Here
5
node_modules/
5
node_modules/
6
koha-tmpl/opac-tmpl/bootstrap/css/maps/
6
koha-tmpl/opac-tmpl/bootstrap/css/maps/
7
koha-tmpl/intranet-tmpl/prog/css/maps/
7
koha-tmpl/intranet-tmpl/prog/css/maps/
8
koha-tmpl/intranet-tmpl/prog/js/built
(-)a/Makefile.PL (-1 / +18 lines)
Lines 1726-1732 sub postamble { Link Here
1726
		$env .= join("\n", map { "export __${_}__ := $config{$_}" } keys %config);
1726
		$env .= join("\n", map { "export __${_}__ := $config{$_}" } keys %config);
1727
	}
1727
	}
1728
1728
1729
    return "$env\n";
1729
    my $js_build_targets = <<'JS';
1730
.PHONY: js-build js-deps js-watch
1731
YARN=node_modules/.bin/yarn
1732
1733
$(YARN):
1734
	npm install yarn
1735
1736
js-deps: $(YARN)
1737
	$(YARN) install
1738
1739
js-build: $(YARN) js-deps
1740
	$(YARN) build
1741
1742
js-watch: $(YARN) js-deps
1743
	$(YARN) watch
1744
JS
1745
1746
    return "$env\n$js_build_targets\n";
1730
}
1747
}
1731
1748
1732
1749
(-)a/gulpfile.js (-1 / +49 lines)
Lines 10-16 try { Link Here
10
    process.exit(1);
10
    process.exit(1);
11
}
11
}
12
12
13
const browserify = require( "browserify" );
13
const gutil = require( "gulp-util" );
14
const gutil = require( "gulp-util" );
15
const source = require( "vinyl-source-stream" );
16
const tap = require( "gulp-tap" );
14
const sass = require("gulp-sass");
17
const sass = require("gulp-sass");
15
const cssnano = require("gulp-cssnano");
18
const cssnano = require("gulp-cssnano");
16
const sourcemaps = require('gulp-sourcemaps');
19
const sourcemaps = require('gulp-sourcemaps');
Lines 21-26 const STAFF_CSS_BASE = "koha-tmpl/intranet-tmpl/prog/css"; Link Here
21
const OPAC_JS_BASE = "koha-tmpl/opac-tmpl/bootstrap/js";
24
const OPAC_JS_BASE = "koha-tmpl/opac-tmpl/bootstrap/js";
22
const OPAC_CSS_BASE = "koha-tmpl/opac-tmpl/bootstrap/css";
25
const OPAC_CSS_BASE = "koha-tmpl/opac-tmpl/bootstrap/css";
23
26
27
// These node modules will be shoved into vendor.js instead of each built file.
28
const VENDOR_DEPENDENCIES = [
29
    "lodash",
30
    "promise-polyfill",
31
    "react",
32
    "react-dom",
33
    "whatwg-fetch",
34
];
35
24
var sassOptions = {
36
var sassOptions = {
25
    errLogToConsole: true,
37
    errLogToConsole: true,
26
    precision: 3
38
    precision: 3
Lines 58-61 gulp.task('build', function() { Link Here
58
70
59
gulp.task('watch', function(){
71
gulp.task('watch', function(){
60
    gulp.watch( css_base + "/src/**/*.scss", ['css'] );
72
    gulp.watch( css_base + "/src/**/*.scss", ['css'] );
61
});
73
});
74
75
let vendorBuilt = false;
76
77
function getBundler() {
78
    let bundler = browserify( {
79
        debug: !process.env.PRODUCTION,
80
    } );
81
82
    if ( process.env.DESCRIPTION ) {
83
        bundler.transform( "uglifyify" );
84
    }
85
86
    return bundler;
87
}
88
89
gulp.task( "build", () => {
90
    if ( !vendorBuilt ) {
91
        getBundler().require( VENDOR_DEPENDENCIES )
92
            .bundle()
93
            .on( "error", gutil.log )
94
            .pipe( source( "vendor.js" ) )
95
            .pipe( gulp.dest( js_base + "/built/" ) );
96
    }
97
98
    let bundler = getBundler().transform( "babelify", { presets: [ "es2015", "react" ], plugins: [ "transform-class-properties" ] } );
99
100
    return gulp.src( js_base + '/src/**/entry.js' )
101
        .pipe( tap( file => {
102
            let base_start = file.path.indexOf( js_base );
103
            gutil.log( `bundling ${file.path.substr( base_start + js_base.length + 1 )}` );
104
105
            bundler.external( VENDOR_DEPENDENCIES );
106
            file.contents = bundler.add( file.path ).bundle();
107
        } ) )
108
        .pipe( gulp.dest( js_base+ "/built" ) );
109
} );
(-)a/package.json (-2 / +14 lines)
Lines 7-18 Link Here
7
    "test": "test"
7
    "test": "test"
8
  },
8
  },
9
  "dependencies": {
9
  "dependencies": {
10
    "babel-plugin-transform-class-properties": "^6.24.1",
11
    "babel-preset-es2015": "^6.24.1",
12
    "babel-preset-react": "^6.24.1",
13
    "babelify": "^7.3.0",
14
    "browserify": "^14.4.0",
10
    "gulp": "^3.9.1",
15
    "gulp": "^3.9.1",
11
    "gulp-autoprefixer": "^4.0.0",
16
    "gulp-autoprefixer": "^4.0.0",
12
    "gulp-cssnano": "^2.1.2",
17
    "gulp-cssnano": "^2.1.2",
13
    "gulp-sass": "^3.1.0",
18
    "gulp-sass": "^3.1.0",
14
    "gulp-sourcemaps": "^2.6.1",
19
    "gulp-sourcemaps": "^2.6.1",
15
    "gulp-util": "^3.0.8"
20
    "gulp-tap": "^1.0.1",
21
    "gulp-util": "^3.0.8",
22
    "lodash": "^4.17.4",
23
    "promise-polyfill": "^6.0.2",
24
    "react": "^16.0.0",
25
    "react-dom": "^16.0.0",
26
    "uglifyify": "^4.0.4",
27
    "vinyl-source-stream": "^1.1.0",
28
    "whatwg-fetch": "^2.0.3"
16
  },
29
  },
17
  "devDependencies": {},
30
  "devDependencies": {},
18
  "scripts": {
31
  "scripts": {
19
- 

Return to bug 15522