Browse Source

add babel for theme js

pull/7/head
Cian Butler 4 years ago
parent
commit
093761475e
6 changed files with 1752 additions and 61 deletions
  1. +11
    -0
      .babelrc
  2. +2
    -0
      .eslintignore
  3. +47
    -0
      .eslintrc
  4. +30
    -23
      gulpfile.js
  5. +21
    -3
      package.json
  6. +1641
    -35
      yarn.lock

+ 11
- 0
.babelrc View File

@@ -0,0 +1,11 @@
{
"presets": [
"es2015"
],
"plugins": [
"add-module-exports",
"transform-object-assign",
"es6-promise",
"transform-async-to-generator"
]
}

+ 2
- 0
.eslintignore View File

@@ -0,0 +1,2 @@
node_modules/
dist

+ 47
- 0
.eslintrc View File

@@ -0,0 +1,47 @@
{
"extends": "standard",
"env": {
"es6": true,
"jest": true,
"node": true
},
"globals": {
"GENTLY": true
},
"rules": {
"no-multi-spaces": 0,
"comma-dangle": [
"error",
"always-multiline"
],
"key-spacing": [
"error",
{
"multiLine": {
"beforeColon": false,
"afterColon": true
},
"align": {
"beforeColon": false,
"afterColon": true,
"on": "colon",
"mode": "strict"
}
}
],
"semi": [
"error",
"always"
],
"no-var": [
"error"
],
"prefer-const": [
"error",
{
"destructuring": "any",
"ignoreReadBeforeAssign": false
}
]
}
}

+ 30
- 23
gulpfile.js View File

@@ -1,28 +1,18 @@
const gulp = require('gulp');
const sass = require('gulp-sass');
const connect = require('gulp-connect');
const babel = require('gulp-babel');
const concat = require('gulp-concat');
const minify = require('gulp-minify');

gulp.task('copy-images', () => {
return gulp.src('./theme/images/*')
.pipe(gulp.dest('./dist/images/'));
});
gulp.task('copy-images', () => gulp.src('./theme/images/*').pipe(gulp.dest('./dist/images/')));

gulp.task('sass', () => {
return gulp.src('./theme/redbrick.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./dist/css'));
});
gulp.task('sass', () => gulp.src('./theme/redbrick.scss').pipe(sass().on('error', sass.logError)).pipe(gulp.dest('./dist/css')));

gulp.task('copy-css', () => {
return gulp.src([
'./node_modules/reveal.js/css/print/pdf.css',
'./node_modules/reveal.js/css/print/paper.css'
])
.pipe(gulp.dest('dist/css'));
});
gulp.task('copy-css', () => gulp.src(['./node_modules/reveal.js/css/print/pdf.css', './node_modules/reveal.js/css/print/paper.css']).pipe(gulp.dest('dist/css')));

gulp.task('copy-js', () => {
return gulp.src([
gulp.task('copy-js', () =>
gulp.src([
'./node_modules/reveal.js/js/reveal.js',
'./node_modules/reveal.js/lib/js/head.min.js',
'./node_modules/reveal.js/lib/js/classList.js',
@@ -32,10 +22,27 @@ gulp.task('copy-js', () => {
'./node_modules/reveal.js/plugin/zoom-js/zoom.js',
'./node_modules/reveal.js/plugin/highlight/highlight.js',
'./node_modules/reveal.js/plugin/markdown/markdown.js',
'./node_modules/reveal.js/plugin/markdown/marked.js'
])
.pipe(gulp.dest('dist/js'));
});
'./node_modules/reveal.js/plugin/markdown/marked.js',
])
.pipe(gulp.dest('dist/js'))
);

gulp.task('compress', () => gulp
.src('./theme/*.js')
.pipe(concat('main.js'))
.pipe(babel())
.pipe(
minify({
ext: {
min: '.min.js',
},
exclude : ['tasks'],
noSource : true,
ignoreFiles: ['.combo.js', '*.min.js'],
})
)
.pipe(gulp.dest('dist/js'))
);

gulp.task('serve', ['default'], () => {
connect.server({
@@ -45,4 +52,4 @@ gulp.task('serve', ['default'], () => {
});
});

gulp.task('default', ['copy-images', 'copy-js', 'copy-css', 'sass']);
gulp.task('default', ['copy-images', 'copy-js', 'copy-css', 'compress', 'sass']);

+ 21
- 3
package.json View File

@@ -7,7 +7,9 @@
"test": "echo \"Error: no test specified\" && exit 1",
"build": "gulp",
"start": "gulp serve",
"postinstall": "gulp"
"postinstall": "gulp",
"lint": "eslint .",
"fix": "eslint . --fix"
},
"repository": {
"type": "git",
@@ -25,11 +27,27 @@
},
"homepage": "https://github.com/redbrick/reveal-slides#readme",
"devDependencies": {
"babel-cli": "6.23.0",
"babel-core": "6.23.1",
"babel-eslint": "7.1.1",
"babel-plugin-add-module-exports": "0.2.1",
"babel-plugin-es6-promise": "1.1.1",
"babel-plugin-syntax-async-functions": "6.13.0",
"babel-plugin-transform-async-to-generator": "6.22.0",
"babel-plugin-transform-object-assign": "6.22.0",
"babel-preset-es2015": "6.22.0",
"eslint": "3.16.1",
"eslint-config-standard": "6.2.1",
"eslint-plugin-promise": "3.5.0",
"eslint-plugin-standard": "2.1.0",
"gulp": "^3.9.1",
"gulp-sass": "^2.3.2",
"reveal.js": "^3.3.0"
},
"dependencies": {
"gulp-connect": "^5.0.0"
"gulp-babel": "^6.1.2",
"gulp-concat": "^2.6.1",
"gulp-connect": "^5.0.0",
"gulp-minify": "^0.0.15"
}
}
}

+ 1641
- 35
yarn.lock
File diff suppressed because it is too large
View File


Loading…
Cancel
Save