Skip to content

Commit

Permalink
Added grnt task
Browse files Browse the repository at this point in the history
  • Loading branch information
makotokw committed Feb 12, 2017
1 parent f4e1402 commit 8fb1394
Show file tree
Hide file tree
Showing 8 changed files with 292 additions and 145 deletions.
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

# Due to a bug in the EditorConfig for SublimeText, we set tab indentation for
# all files and we set exceptions for all files with an extension

[*]
end_of_line = lf
charset = utf-8

[*.html]
indent_style = space
indent_size = 2

[*.{css,sass}]
indent_style = space
indent_size = 2

[*.js]
indent_style = space
indent_size = 2
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.DS_Store
.idea/
node_modules/
dist/
tmp/
121 changes: 121 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
'use strict';

module.exports = function (grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);

// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);

var _ = require('lodash');

var now = new Date();
var pkg = grunt.file.readJSON('package.json');
pkg = _.assign(
pkg,
{
src: './src',
dist: './dist',
demo: './demo'
}
);

var license = grunt.file.read('./license-header.txt');
license = grunt.template.process(license, {
data: {
buildYear: now.getFullYear(),
version: pkg.version
}
});

//noinspection JSUnusedGlobalSymbols,JSUnresolvedFunction
grunt.initConfig({
pkg: _.assign(
pkg,
{
src: './src',
dist: './dist',
demo: './demo'
}
),

clean: {
dist: {
src: ['<%= pkg.dist %>']
}
},

concat: {
options: {
banner: license
},
dist: {
files: {
'<%= pkg.dist %>/jquery.ui.potato.menu.css': '<%= pkg.src %>/jquery.ui.potato.menu.css',
'<%= pkg.dist %>/jquery.ui.potato.menu.js': '<%= pkg.src %>/jquery.ui.potato.menu.js'
}
}
},

cssmin: {
options: {
keepSpecialComments: 1
},
dist: {
files: {
'<%= pkg.dist %>/jquery.ui.potato.menu.min.css': '<%= pkg.dist %>/jquery.ui.potato.menu.css'
}
}
},

uglify: {
options: {
preserveComments: 'some'
},
dist: {
files: {
'<%= pkg.dist %>/jquery.ui.potato.menu.min.js': '<%= pkg.dist %>/jquery.ui.potato.menu.js'
}
}
},

/* jshint ignore:start */
notify_hooks: {
options: {
enabled: true,
success: false,
duration: 3
}
}
,
/* jshint ignore:end */

browserSync: {
demo: {
bsFiles: {
src: '<%= pkg.demo %>/*.html'
}
,
options: {
server: ['./'],
startPath: '<%= pkg.demo %>/index.html'
}
}
}
});

grunt.registerTask('debug', function (/*target*/) {
grunt.task.run([
'browserSync'
]);
});

grunt.registerTask('build', function (/*target*/) {
grunt.task.run([
'clean',
'concat',
'uglify',
'cssmin'
]);
});
};
3 changes: 1 addition & 2 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>jquery.ui.potato.menu</title>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<!--<script type="text/javascript" src="../src/jquery.ui.potato.menu.js"></script>-->
<script type="text/javascript" src="../dist/jquery.ui.potato.menu.min.js"></script>
<script type="text/javascript" src="../src/jquery.ui.potato.menu.js"></script>
<link rel=stylesheet href="../src/jquery.ui.potato.menu.css">
<style>
#menu1 {}
Expand Down
9 changes: 9 additions & 0 deletions license-header.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*!
* jquery.ui.potato.menu
*
* Copyright (c) 2009-<%= buildYear %> makoto_kw, https://makotokw.com
*
* @author makoto_kw
* @version <%= version %>
* @license MIT
*/
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,17 @@
},
"homepage": "https://github.com/makotokw/jquery.ui.potato.menu#readme",
"devDependencies": {
"grunt": "^1.0.1",
"grunt-browser-sync": "^2.2.0",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-cssmin": "^1.0.2",
"grunt-contrib-uglify": "^2.1.0",
"grunt-notify": "^0.4.5",
"load-grunt-tasks": "^3.5.2",
"lodash": "^4.17.4",
"shelljs": "^0.6.0",
"time-grunt": "^1.4.0",
"uglify-js": "^2.6.2"
}
}
89 changes: 42 additions & 47 deletions src/jquery.ui.potato.menu.css
Original file line number Diff line number Diff line change
@@ -1,48 +1,43 @@
/**
* jquery.ui.potato.menu
*
* Copyright (c) 2009-2016 makoto_kw, http://makotokw.com
*
* @author makoto_kw
* @version 1.2.1
* @license MIT
*/
.potato-menu {
margin:0;
padding:0;
width:auto;
list-style:none;
}
.potato-menu:after {
content: " ";
display: block;
visibility: hidden;
clear: both;
height: 0.1px;
font-size: 0.1em;
line-height: 0;
}
.potato-menu .potato-menu-item {
padding:0;
position:relative;
list-style:none;
list-style-position:outside;
display:inline;
margin:0;
float:left;
}
.potato-menu .potato-menu-item a {
display:block;
text-decoration:none;
white-space:nowrap;
outline:0;
}
.potato-menu .potato-menu-group {
margin:0;
padding:0;
-webkit-padding-start:0;
-webkit-padding-end:0;
position:absolute;
display:none;
z-index:1000;
.potato-menu {
margin: 0;
padding: 0;
width: auto;
list-style: none;
}

.potato-menu:after {
content: " ";
display: block;
visibility: hidden;
clear: both;
height: 0.1px;
font-size: 0.1em;
line-height: 0;
}

.potato-menu .potato-menu-item {
padding: 0;
position: relative;
list-style: none;
list-style-position: outside;
display: inline;
margin: 0;
float: left;
}

.potato-menu .potato-menu-item a {
display: block;
text-decoration: none;
white-space: nowrap;
outline: 0;
}

.potato-menu .potato-menu-group {
margin: 0;
padding: 0;
-webkit-padding-start: 0;
-webkit-padding-end: 0;
position: absolute;
display: none;
z-index: 1000;
}
Loading

0 comments on commit 8fb1394

Please sign in to comment.