Skip to content

Commit

Permalink
Migrate from another project.
Browse files Browse the repository at this point in the history
  • Loading branch information
NaotoshiFujita committed Jul 25, 2019
0 parents commit fb7c20b
Show file tree
Hide file tree
Showing 87 changed files with 19,653 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .babelrc
@@ -0,0 +1,20 @@
{
"presets": [
[
"@babel/env",
{
"modules": false,
"loose": true
}
]
],
"env": {
"test": {
"presets": [
[
"@babel/env"
]
]
}
}
}
9 changes: 9 additions & 0 deletions .editorconfig
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = tab
indent_size = 2
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
27 changes: 27 additions & 0 deletions .eslintrc
@@ -0,0 +1,27 @@
{
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"env": {
"browser": true,
"jest": true,
"node": true
},
"rules": {
"array-bracket-spacing": [ "error", "always" ],
"camelcase": "error",
"comma-dangle": [ "error", {
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "never"
} ],
"comma-spacing": [ "error", { "before": false, "after": true } ],
"eqeqeq": "error",
"indent": [ "error", "tab", { "SwitchCase": 1 } ],
"no-console": [ "error", { "allow": [ "warn", "error" ] } ]
}
}
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
node_modules/
20 changes: 20 additions & 0 deletions LICENSE
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2019 Naotoshi Fujita

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 changes: 8 additions & 0 deletions build/banner.js
@@ -0,0 +1,8 @@
const info = require( '../package' );

module.exports = `/*!
* Splide.js
* Version : ${ info.version }
* License : ${ info.license }
* Copyright: 2019 ${ info.author }
*/`;
25 changes: 25 additions & 0 deletions build/complete/complete.js
@@ -0,0 +1,25 @@
/**
* Export "splide" function for frontend with full components.
*
* @author Naotoshi Fujita
* @copyright Naotoshi Fujita. All rights reserved.
*/

import Splide from '../../src/js/splide';
import { COMPLETE } from '../../src/js/components';


/**
* Create and return a new Splide instance.
*
* @param {Element|string} root - A root element or a selector for it.
* @param {Object} options - Optional. Options overwriting defaults.
*
* @return {Splide} - A Splide instance.
*/
export default function splide( root, options = {} ) {
return new Splide( root, options, COMPLETE );
}

// Register the function above as global for non-ES6 environment.
window.splide = splide;
30 changes: 30 additions & 0 deletions build/complete/config.js
@@ -0,0 +1,30 @@
const uglify = require( 'uglifyjs-webpack-plugin' );
const webpack = require( 'webpack' );

module.exports = {
entry: './build/complete/complete.js',
output: {
filename : 'splide.js',
library : 'Splide',
libraryTarget: 'umd',
},
module: {
rules: [
{
test : /.js$/,
loader : 'babel-loader',
exclude: /node_modules/,
},
],
},
plugins: [
new webpack.BannerPlugin( {
banner: require( '../banner' ),
raw : true,
} ),
],
optimization: {
minimizer: [ new uglify() ],
},
mode: 'production',
};
1 change: 1 addition & 0 deletions dist/splide-core.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/splide-theme.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/splide.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions dist/splide.min.js

Large diffs are not rendered by default.

81 changes: 81 additions & 0 deletions gulpfile.js
@@ -0,0 +1,81 @@
'use strict';

/*
* Dependencies.
*/
const gulp = require( 'gulp' );
const rename = require( 'gulp-rename' );
const sass = require( 'gulp-sass' );
const postcss = require( 'gulp-postcss' );
const autoprefixer = require( 'autoprefixer' );
const cssnano = require( 'cssnano' );
const merge = require( 'merge-stream' );
const concat = require( 'gulp-concat' );
const webpackStream = require( 'webpack-stream' );
const eslint = require( 'gulp-eslint' );

/*
* Webpack config paths.
*/
const js = [
'./build/complete/config',
];

/*
* Path definitions.
*/
const css = {
core: {
path: './src/sass/core/splide-core.scss',
dest: './dist',
},
theme: {
path: './src/sass/theme/splide-theme.scss',
dest: './dist',
},
};

/*
* Build a script file.
*/
gulp.task( 'build:js', () => {
js.forEach( path => {
return webpackStream( { config: require( path ) } )
.pipe( rename( { suffix: '.min' } ) )
.pipe( gulp.dest( './dist' ) );
} );
} );

/*
* Build sass files.
*/
gulp.task( 'build:sass', () => {
let mergedStream;

Object.values( css ).forEach( settings => {
const stream = gulp.src( settings.path )
.pipe( sass() )
.pipe( postcss( [
cssnano( { reduceIdents: false } ),
autoprefixer( { browsers: [ '> 5%' ] } )
] ) )
.pipe( rename( { suffix: '.min' } ) )
.pipe( gulp.dest( settings.dest ) );

mergedStream = ! mergedStream ? stream : merge( mergedStream, stream );
} );

if ( mergedStream ) {
mergedStream
.pipe( concat( 'splide.min.css' ) )
.pipe( postcss( [ cssnano( { reduceIdents: false } ) ] ) )
.pipe( gulp.dest( './dest' ) );
}
} );

gulp.task( 'lint', () => {
return gulp.src( [ './src/**/*.js', './tests/**/*.js' ] )
.pipe( eslint( { useEslintrc: true } ) )
.pipe( eslint.format() )
.pipe( eslint.failAfterError() );
} );
3 changes: 3 additions & 0 deletions jest.config.js
@@ -0,0 +1,3 @@
module.exports = {
rootDir: './tests',
};

0 comments on commit fb7c20b

Please sign in to comment.