Refactor code structure
This commit is contained in:
parent
b7abf671ea
commit
3c6245497e
23
gulpfile.js
23
gulpfile.js
|
@ -5,15 +5,13 @@ var gulp = require('gulp')
|
|||
, spawn = require('child_process').spawn
|
||||
, $ = require('gulp-load-plugins')()
|
||||
|
||||
/**
|
||||
* Public tasks
|
||||
*/
|
||||
// Tasks
|
||||
gulp.task('clean', function () {
|
||||
return pipe('./tmp', [$.clean()])
|
||||
})
|
||||
|
||||
gulp.task('build', function (cb) {
|
||||
$.runSequence('clean', 'css', 'chrome', 'opera', 'safari', 'firefox', cb)
|
||||
$.runSequence('clean', 'styles', 'chrome', 'opera', 'safari', 'firefox', cb)
|
||||
})
|
||||
|
||||
gulp.task('default', ['build'], function () {
|
||||
|
@ -34,11 +32,10 @@ gulp.task('test', ['build'], function (cb) {
|
|||
ps.on('close', cb)
|
||||
})
|
||||
|
||||
/**
|
||||
* Private tasks
|
||||
*/
|
||||
gulp.task('css', function () {
|
||||
return pipe('./src/css/octotree.less', [$.less(), $.autoprefixer({cascade: true})], './tmp')
|
||||
gulp.task('styles', function () {
|
||||
return pipe('./src/styles/octotree.less',
|
||||
[$.less(), $.autoprefixer({cascade: true})],
|
||||
'./tmp')
|
||||
})
|
||||
|
||||
// Chrome
|
||||
|
@ -120,9 +117,7 @@ gulp.task('firefox:xpi', function (cb) {
|
|||
$.run('cd ./tmp/firefox && cfx xpi --output-file=../../dist/firefox.xpi').exec(cb)
|
||||
})
|
||||
|
||||
/**
|
||||
* Helpers
|
||||
*/
|
||||
// Helpers
|
||||
function pipe(src, transforms, dest) {
|
||||
if (typeof transforms === 'string') {
|
||||
dest = transforms
|
||||
|
@ -157,8 +152,8 @@ function buildJs(additions, ctx) {
|
|||
'./tmp/template.js',
|
||||
'./src/constants.js',
|
||||
'./src/adapters/adapter.js',
|
||||
'./src/adapters/adapter.github.js',
|
||||
'./src/adapters/adapter.gitlab.js',
|
||||
'./src/adapters/github.js',
|
||||
'./src/adapters/gitlab.js',
|
||||
'./src/view.help.js',
|
||||
'./src/view.error.js',
|
||||
'./src/view.tree.js',
|
||||
|
|
|
@ -14,7 +14,7 @@ const
|
|||
, GH_PJAX_SEL = '#js-repo-pjax-container'
|
||||
, GH_CONTAINERS = '.container'
|
||||
|
||||
GitHub.prototype = new Adapter()
|
||||
GitHub.prototype = Object.create(Adapter.prototype)
|
||||
GitHub.prototype.constructor = GitHub
|
||||
GitHub.prototype.super = Adapter.prototype
|
||||
|
|
@ -10,7 +10,7 @@ const
|
|||
, GL_SHIFTED = 'h1.title'
|
||||
, GL_PROJECT_ID = '#project_id'
|
||||
|
||||
GitLab.prototype = new Adapter()
|
||||
GitLab.prototype = Object.create(Adapter.prototype)
|
||||
GitLab.prototype.constructor = GitLab
|
||||
GitLab.prototype.super = Adapter.prototype
|
||||
|
||||
|
@ -78,7 +78,7 @@ GitLab.prototype.updateLayout = function(sidebarVisible, sidebarWidth) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Filter particular options for current adapter.
|
||||
* Filters particular options for current adapter.
|
||||
* @param {DOM Object} dom - the template which needs to be filtered.
|
||||
*/
|
||||
GitLab.prototype.filterOption = function(dom) {
|
|
@ -263,5 +263,3 @@ a.octotree_toggle {
|
|||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
@import "octotree_github";
|
||||
@import "octotree_gitlab";
|
|
@ -0,0 +1,3 @@
|
|||
@import "common";
|
||||
@import "github";
|
||||
@import "gitlab";
|
Loading…
Reference in New Issue