Last active
October 25, 2018 10:11
-
-
Save panoply/7831d45a971efe31f17396a2b2c6b06c to your computer and use it in GitHub Desktop.
Rollup / Gulp configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* PLUGINS */ | |
import rollupStream from 'rollup-stream' | |
import buffer from 'vinyl-buffer' | |
import resolve from 'rollup-plugin-node-resolve' | |
import commonjs from 'rollup-plugin-commonjs' | |
import includePaths from 'rollup-plugin-includepaths' | |
import buble from 'rollup-plugin-buble' | |
import { uglify } from 'rollup-plugin-uglify' | |
import uglifyEs from 'rollup-plugin-uglify-es' | |
import fileSize from 'rollup-plugin-filesize' | |
import rollupEach from 'gulp-rollup-each' | |
export default (gulp, plugins, file, mode, sync) => { | |
return () => { | |
gulp.src(`${file.path}/${file.input}.js`) | |
.pipe(mode.development(plugins.sourcemaps.init())) | |
.pipe(rollupEach({ | |
cache: true, | |
external: mode.development() ? file.external : [], | |
plugins: [ | |
includePaths({ | |
extensions: ['.js'], | |
paths: output.includePaths | |
}), | |
resolve({ | |
jsnext: true, | |
browser: true | |
}), | |
commonjs({ | |
include: 'node_modules/**' | |
}), | |
buble(), | |
mode.production(file.input === 'photoswipe' ? uglify() : uglifyEs()), | |
fileSize() | |
] | |
}, { | |
globals: output.globals, | |
format: file.format, | |
name: file.name, | |
banner: '// @brixtoltextiles' | |
}, require('rollup'))) | |
.pipe(mode.development(plugins.sourcemaps.write('.'))) | |
.pipe(gulp.dest(config.theme.assets)) | |
.pipe(mode.development(sync.stream())) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment