mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-15 23:01:44 +03:00
Moved jQuery to use NPM and fixed some asset refs
This commit is contained in:
83
gulpfile.js
83
gulpfile.js
@ -1,83 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const argv = require('yargs').argv;
|
|
||||||
const gulp = require('gulp'),
|
|
||||||
plumber = require('gulp-plumber');
|
|
||||||
|
|
||||||
const autoprefixer = require('gulp-autoprefixer');
|
|
||||||
const minifycss = require('gulp-clean-css');
|
|
||||||
const sass = require('gulp-sass');
|
|
||||||
const sourcemaps = require('gulp-sourcemaps');
|
|
||||||
|
|
||||||
const browserify = require("browserify");
|
|
||||||
const source = require('vinyl-source-stream');
|
|
||||||
const buffer = require('vinyl-buffer');
|
|
||||||
const babelify = require("babelify");
|
|
||||||
const watchify = require("watchify");
|
|
||||||
const envify = require("envify");
|
|
||||||
const uglify = require('gulp-uglify');
|
|
||||||
|
|
||||||
const gutil = require("gulp-util");
|
|
||||||
const liveReload = require('gulp-livereload');
|
|
||||||
|
|
||||||
if (argv.production) process.env.NODE_ENV = 'production';
|
|
||||||
let isProduction = argv.production || process.env.NODE_ENV === 'production';
|
|
||||||
|
|
||||||
gulp.task('styles', () => {
|
|
||||||
let chain = gulp.src(['resources/assets/sass/**/*.scss'])
|
|
||||||
.pipe(sourcemaps.init())
|
|
||||||
.pipe(plumber({
|
|
||||||
errorHandler: function (error) {
|
|
||||||
console.log(error.message);
|
|
||||||
this.emit('end');
|
|
||||||
}}))
|
|
||||||
.pipe(sass())
|
|
||||||
.pipe(autoprefixer('last 2 versions'));
|
|
||||||
if (isProduction) chain = chain.pipe(minifycss());
|
|
||||||
chain = chain.pipe(sourcemaps.write());
|
|
||||||
return chain.pipe(gulp.dest('public/css/')).pipe(liveReload());
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
function scriptTask(watch = false) {
|
|
||||||
|
|
||||||
let props = {
|
|
||||||
basedir: 'resources/assets/js',
|
|
||||||
debug: true,
|
|
||||||
entries: ['global.js'],
|
|
||||||
fast: !isProduction,
|
|
||||||
cache: {},
|
|
||||||
packageCache: {},
|
|
||||||
};
|
|
||||||
|
|
||||||
let bundler = watch ? watchify(browserify(props), { poll: true }) : browserify(props);
|
|
||||||
|
|
||||||
if (isProduction) {
|
|
||||||
bundler.transform(envify, {global: true}).transform(babelify, {presets: ['es2015']});
|
|
||||||
}
|
|
||||||
|
|
||||||
function rebundle() {
|
|
||||||
let stream = bundler.bundle();
|
|
||||||
stream = stream.pipe(source('common.js'));
|
|
||||||
if (isProduction) stream = stream.pipe(buffer()).pipe(uglify());
|
|
||||||
return stream.pipe(gulp.dest('public/js/')).pipe(liveReload());
|
|
||||||
}
|
|
||||||
|
|
||||||
bundler.on('update', function() {
|
|
||||||
rebundle();
|
|
||||||
gutil.log('Rebundling assets...');
|
|
||||||
});
|
|
||||||
|
|
||||||
bundler.on('log', gutil.log);
|
|
||||||
return rebundle();
|
|
||||||
}
|
|
||||||
|
|
||||||
gulp.task('scripts', () => {scriptTask(false)});
|
|
||||||
gulp.task('scripts-watch', () => {scriptTask(true)});
|
|
||||||
|
|
||||||
gulp.task('default', ['styles', 'scripts-watch'], () => {
|
|
||||||
liveReload.listen();
|
|
||||||
gulp.watch("resources/assets/sass/**/*.scss", ['styles']);
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('build', ['styles', 'scripts']);
|
|
5
package-lock.json
generated
5
package-lock.json
generated
@ -5905,6 +5905,11 @@
|
|||||||
"is-object": "1.0.1"
|
"is-object": "1.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"jquery": {
|
||||||
|
"version": "3.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz",
|
||||||
|
"integrity": "sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg=="
|
||||||
|
},
|
||||||
"js-base64": {
|
"js-base64": {
|
||||||
"version": "2.4.3",
|
"version": "2.4.3",
|
||||||
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.4.3.tgz",
|
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.4.3.tgz",
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
"clipboard": "^2.0.0",
|
"clipboard": "^2.0.0",
|
||||||
"codemirror": "^5.26.0",
|
"codemirror": "^5.26.0",
|
||||||
"dropzone": "^5.4.0",
|
"dropzone": "^5.4.0",
|
||||||
|
"jquery": "^3.3.1",
|
||||||
"markdown-it": "^8.3.1",
|
"markdown-it": "^8.3.1",
|
||||||
"markdown-it-task-lists": "^2.0.0",
|
"markdown-it-task-lists": "^2.0.0",
|
||||||
"moment": "^2.21.0",
|
"moment": "^2.21.0",
|
||||||
|
7
public/libs/jquery/jquery-ui.min.js
vendored
7
public/libs/jquery/jquery-ui.min.js
vendored
File diff suppressed because one or more lines are too long
5
public/libs/jquery/jquery.min.js
vendored
5
public/libs/jquery/jquery.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,5 +1,9 @@
|
|||||||
import "babel-polyfill"
|
import "babel-polyfill"
|
||||||
import "./dom-polyfills"
|
import "./dom-polyfills"
|
||||||
|
|
||||||
|
import jQuery from "jquery"
|
||||||
|
window.jQuery = window.$ = jQuery;
|
||||||
|
|
||||||
import "./pages/page-show"
|
import "./pages/page-show"
|
||||||
import Translations from "./translations"
|
import Translations from "./translations"
|
||||||
import vues from "./vues/vues"
|
import vues from "./vues/vues"
|
||||||
|
@ -350,7 +350,7 @@ if (document.querySelector('[drawio-enabled]').getAttribute('drawio-enabled') ==
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
selector: '#html-editor',
|
selector: '#html-editor',
|
||||||
content_css: [
|
content_css: [
|
||||||
window.baseUrl('/css/styles.css'),
|
window.baseUrl('/dist/styles.css'),
|
||||||
],
|
],
|
||||||
branding: false,
|
branding: false,
|
||||||
body_class: 'page-content',
|
body_class: 'page-content',
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
<link rel="stylesheet" media="print" href="{{ versioned_asset('dist/print-styles.css') }}">
|
<link rel="stylesheet" media="print" href="{{ versioned_asset('dist/print-styles.css') }}">
|
||||||
|
|
||||||
<!-- Scripts -->
|
<!-- Scripts -->
|
||||||
<script src="{{ baseUrl('/libs/jquery/jquery.min.js?version=2.1.4') }}"></script>
|
|
||||||
<script src="{{ baseUrl('/libs/jquery/jquery-ui.min.js?version=1.11.4') }}"></script>
|
|
||||||
<script src="{{ baseUrl('/translations') }}"></script>
|
<script src="{{ baseUrl('/translations') }}"></script>
|
||||||
|
|
||||||
@yield('head')
|
@yield('head')
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
@extends('simple-layout')
|
@extends('simple-layout')
|
||||||
|
|
||||||
@section('head')
|
|
||||||
<script src="{{ baseUrl("/libs/jquery-sortable/jquery-sortable.min.js") }}"></script>
|
|
||||||
@stop
|
|
||||||
|
|
||||||
@section('toolbar')
|
@section('toolbar')
|
||||||
<div class="col-sm-12 faded">
|
<div class="col-sm-12 faded">
|
||||||
@include('books._breadcrumbs', ['book' => $book])
|
@include('books._breadcrumbs', ['book' => $book])
|
||||||
@ -52,11 +48,12 @@
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@stop
|
||||||
|
|
||||||
|
@section('scripts')
|
||||||
|
<script src="{{ baseUrl("/libs/jquery-sortable/jquery-sortable.min.js") }}"></script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ const dev = process.env.NODE_ENV !== 'production';
|
|||||||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
|
target: 'web',
|
||||||
mode: dev? 'development' : 'production',
|
mode: dev? 'development' : 'production',
|
||||||
entry: {
|
entry: {
|
||||||
app: './resources/assets/js/index.js',
|
app: './resources/assets/js/index.js',
|
||||||
|
Reference in New Issue
Block a user