-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plantingjs from npm #68
Changes from all commits
45d41bc
2e30497
47bf53e
94e9a2b
e08ac4c
3585e41
346e6e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
'extends': 'airbnb', | ||
'ecmaFeatures': {'modules': true}, | ||
'env': { | ||
'es6': true, | ||
'browser': true, | ||
'node': true | ||
}, | ||
'parser': 'babel-eslint' | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
|
||
.coverage | ||
db.sqlite3 | ||
wysadzulice/static/plantingjs | ||
node_modules | ||
wysadzulice/static |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import autoprefixer from 'gulp-autoprefixer'; | ||
import babelify from 'babelify'; | ||
import browserify from 'browserify'; | ||
import concat from 'gulp-concat'; | ||
import del from 'del'; | ||
import domain from 'domain'; | ||
import flatten from 'gulp-flatten'; | ||
import filter from 'gulp-filter'; | ||
import gulp from 'gulp'; | ||
import gutil from 'gulp-util'; | ||
import hbsfy from 'hbsfy'; | ||
import plumber from 'gulp-plumber'; | ||
import sass from 'gulp-sass'; | ||
import tap from 'gulp-tap'; | ||
|
||
|
||
/* Default task */ | ||
gulp.task('default', function() { | ||
gulp.start('build'); | ||
}); | ||
|
||
|
||
/* Removing whole ./wysadzulice/static/ directory */ | ||
gulp.task('clean', del.bind(null, './wysadzulice/static')); | ||
|
||
|
||
/* Building JS */ | ||
gulp.task('js', function() { | ||
return gulp.src('./wysadzulice/assets/main.js') | ||
.pipe(plumber()) | ||
.pipe(tap(function(file) { | ||
const dom = domain.create(); | ||
dom.on('error', function(err) { | ||
gutil.log( | ||
gutil.colors.red('Browserify compile error:'), | ||
err.message, '\n\t', | ||
gutil.colors.cyan('in file'), file.path | ||
); | ||
gutil.beep(); | ||
}); | ||
dom.run(function() { | ||
file.contents = browserify({ | ||
entries: [file.path], | ||
debug: false, | ||
standalone: 'Planting', | ||
paths: ['./node_modules/', './wysadzulice/assets/'], | ||
transform: [ | ||
[hbsfy, { | ||
global: true, | ||
ignore: /\/node_modules\/(?!plantingjs\/)/, | ||
}], | ||
[babelify, { | ||
global: true, | ||
ignore: /\/node_modules\/(?!plantingjs\/)/, | ||
}], | ||
], | ||
}).bundle(); | ||
}); | ||
})) | ||
.pipe(gulp.dest('./wysadzulice/static/wysadzulice/js/')); | ||
}); | ||
/* End of building JS */ | ||
|
||
/* Building CSS */ | ||
gulp.task('css:main', function() { | ||
return gulp.src('./wysadzulice/assets/styles/**/*.scss') | ||
.pipe(sass()) | ||
.pipe(autoprefixer({browsers: ['last 1 version']})) | ||
.pipe(concat('main.css')) | ||
.pipe(gulp.dest('./wysadzulice/static/wysadzulice/styles/')); | ||
}); | ||
|
||
gulp.task('css:vendor', function() { | ||
return gulp.src([ | ||
'./node_modules/jquery-ui/themes/base/jquery-ui.css', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need jquery-ui here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't checked it it used in plantingjs, and have just recreate gulp task from there - in plantingjs we are concatenating Maybe we should create separate task for plantingjs to investigate if we really are using these styles? |
||
'./node_modules/jquery-ui/themes/base/jquery.ui.dialog.css', | ||
'./node_modules/plantingjs/src/styles/*.scss', | ||
]) | ||
.pipe(sass()) | ||
.pipe(concat('vendor.css')) | ||
.pipe(gulp.dest('./wysadzulice/static/wysadzulice/styles/')); | ||
}); | ||
|
||
gulp.task('css', ['css:vendor', 'css:main']); | ||
/* End of building CSS */ | ||
|
||
|
||
/* Building fonts */ | ||
gulp.task('fonts', function() { | ||
return gulp.src('./node_modules/plantingjs/src/fonts/**/*') | ||
.pipe(filter('**/*.{eot,svg,ttf,woff}')) | ||
.pipe(flatten()) | ||
.pipe(gulp.dest('./wysadzulice/static/wysadzulice/fonts')); | ||
}); | ||
/* End of building fonts */ | ||
|
||
|
||
/* Building assets */ | ||
gulp.task('assets:main', function() { | ||
return gulp.src('./wysadzulice/assets/assets/**/*') | ||
.pipe(gulp.dest('./wysadzulice/static/wysadzulice/assets/main')); | ||
}); | ||
|
||
gulp.task('assets:vendor', function() { | ||
return gulp.src('./wysadzulice/assets/assets/**/*') | ||
.pipe(gulp.dest('./wysadzulice/static/wysadzulice/assets/vendor')); | ||
}); | ||
|
||
gulp.task('assets', ['assets:main', 'assets:vendor']); | ||
/* End of building assets */ | ||
|
||
|
||
/* Building all frontend assets */ | ||
gulp.task('build', ['assets', 'css', 'fonts', 'js']); | ||
/* End of building all frontend assets */ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"dependencies": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need whole There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're probably right here, but because we need to build plantingjs here, we need also this dependencies. I believe when we will create proper npm package (that one with all kind of scripts) we will be able to remove lot of these dependencies. And as for dev dependencies - I will create separate issue for that - we will do it in less busy time. |
||
"babelify": "^6.4.0", | ||
"browserify": "^11.2.0", | ||
"plantingjs": "git://github.com/komitywa/plantingjs", | ||
"babel-core": "^5.8.29", | ||
"gulp": "^3.9.0", | ||
"gulp-util": "^3.0.6", | ||
"hbsfy": "^2.4.1", | ||
"handlebars": "^4.0.4", | ||
"gulp-plumber": "^1.0.1", | ||
"gulp-tap": "^0.1.3", | ||
"gulp-autoprefixer": "^1.0.1", | ||
"gulp-sass": "^2.0.4", | ||
"jquery-ui": "^1.10.5", | ||
"del": "^0.1.0", | ||
"gulp-filter": "^1.0.2", | ||
"gulp-flatten": "^0.0.4" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"lat": 52.3965155, | ||
"lng": 16.8978846, | ||
"zoom": 14, | ||
"toolboxobjects": [ | ||
{ | ||
"projections": [ | ||
"/static/wysadzulice/assets/main/objects/00.png", | ||
"/static/wysadzulice/assets/main/objects/10.png", | ||
"/static/wysadzulice/assets/main/objects/20.png", | ||
"/static/wysadzulice/assets/main/objects/30.png", | ||
"/static/wysadzulice/assets/main/objects/40.png", | ||
"/static/wysadzulice/assets/main/objects/50.png", | ||
"/static/wysadzulice/assets/main/objects/60.png", | ||
"/static/wysadzulice/assets/main/objects/70.png", | ||
"/static/wysadzulice/assets/main/objects/80.png", | ||
"/static/wysadzulice/assets/main/objects/00.png", | ||
"/static/wysadzulice/assets/main/objects/10.png", | ||
"/static/wysadzulice/assets/main/objects/20.png", | ||
"/static/wysadzulice/assets/main/objects/30.png", | ||
"/static/wysadzulice/assets/main/objects/40.png", | ||
"/static/wysadzulice/assets/main/objects/50.png", | ||
"/static/wysadzulice/assets/main/objects/60.png", | ||
"/static/wysadzulice/assets/main/objects/70.png", | ||
"/static/wysadzulice/assets/main/objects/80.png", | ||
"/static/wysadzulice/assets/main/objects/00.png", | ||
"/static/wysadzulice/assets/main/objects/10.png", | ||
"/static/wysadzulice/assets/main/objects/20.png", | ||
"/static/wysadzulice/assets/main/objects/30.png", | ||
"/static/wysadzulice/assets/main/objects/40.png", | ||
"/static/wysadzulice/assets/main/objects/50.png", | ||
"/static/wysadzulice/assets/main/objects/60.png", | ||
"/static/wysadzulice/assets/main/objects/70.png", | ||
"/static/wysadzulice/assets/main/objects/80.png", | ||
"/static/wysadzulice/assets/main/objects/00.png", | ||
"/static/wysadzulice/assets/main/objects/10.png", | ||
"/static/wysadzulice/assets/main/objects/20.png", | ||
"/static/wysadzulice/assets/main/objects/30.png", | ||
"/static/wysadzulice/assets/main/objects/40.png", | ||
"/static/wysadzulice/assets/main/objects/50.png", | ||
"/static/wysadzulice/assets/main/objects/60.png", | ||
"/static/wysadzulice/assets/main/objects/70.png", | ||
"/static/wysadzulice/assets/main/objects/80.png" | ||
] | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Planting from 'plantingjs'; | ||
|
||
export default Planting; |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we always use relative paths?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably right. Because all js modules available in
wysadzulice/assets
will be imported into main using relative paths, it looks, that we can freely remove this option from browserify.I will do it at today's meeting.