Browse Source

Praktikum 1/2 und gulp.js

master
Andrea Gaertner 4 years ago
parent
commit
c52c2536db

+ 6
- 0
code/exercise03/app/css/mobile.css View File


h2 small{
color: lightgray;
font-size: small;
}


BIN
code/exercise03/app/img/ohm.ico View File


+ 19
- 0
code/exercise03/app/index.html View File

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>New Project</title>
<link rel="icon" href="img/ohm.ico">
<link rel="stylesheet" href="css/mobile.css">
</head>
<body>
<h2>
New Project
<small>Ein Demoprojekt</small>
</h2>
<script src="lib/es6-shim.min.js"></script>
<script src="lib/jquery-2.2.4.min.js"></script>
<script src="scripts/landung.js"></script>
</body>
</html>

+ 12
- 0
code/exercise03/app/lib/es6-shim.min.js
File diff suppressed because it is too large
View File


+ 4
- 0
code/exercise03/app/lib/jquery-2.2.4.min.js
File diff suppressed because it is too large
View File


+ 5
- 0
code/exercise03/app/sass/style.scss View File

$bgColor: #ff0000;

body{
background:$bgColor;
}

+ 1
- 0
code/exercise03/app/scripts/app.js View File

alert("Hello World!");

+ 61
- 0
code/exercise03/app/scripts/landung.js View File


function simulation() {

function switchOn() {
schub = true;
update();
}

function switchOff() {
schub = false;
update();
}

function a() {
if (schub == false || fuel <= 0)
return -1.63;
else {
fuel = fuel - 100;
return -1.63 + 12;
}
}

function setStartValues() {
var v = -1000;
var s = 50000;
var fuel = 10000;
var schub = false;
}
function update() {
v = v + a();
s = s + v;
if (s <= 0) {
s = 0;
gameOver();
}
$("#height").html("Höhe: " + s + "m");
$("#speed").html("Geschwindigkeit: " + v + "m/s");
$("#fuel").html("Treibstoffvorrat: " + fuel + "l");
}

function gameOver() {
if (v > -10)
alert("Mondlandung geglückt!!!");
else
alert("Mondlandung gescheitert ...");
setStartValues();
}

$("body").append("<div id='height'>Höhe: </div>");
$("body").append("<div id='speed'>Geschwindigkeit: </div>");
$("body").append("<div id='fuel'>Treibstoffvorrat: </div>");

$("body").append("<button id='energy'>Triebwerk an</button>");
$("body").append("<button id='no-energy'>Triebwerk aus</button>");

$("#energy").click(switchOn);
$("#no-energy").click(switchOff);
setStartValues();
}

$(document).ready(simulation);

+ 62
- 0
code/exercise03/gulpfile.js View File

const gulp = require('gulp');
const imagemin = require('gulp-imagemin');
const uglify = require('gulp-uglify');
const sass = require('gulp-sass');
const concat = require('gulp-concat');

/*
* Toplevelfunction
* gulp.task
* gulp.src
* gulp.dest
* gulp.watch
*/

// Logs Message
gulp.task('message', function () {
return console.log('Gulp is running...');
});

// Copy All HTML files
gulp.task('copyHtml', function () {
gulp.src('app/*.html')
.pipe(gulp.dest('dist'));
});

// Optimize Images
gulp.task('imageMin', () =>
gulp.src('app/img/*')
.pipe(imagemin())
.pipe(gulp.dest('dist/images'))
);

// Minify JS
gulp.task('minify', function () {
gulp.src('app/scripts/*.js')
.pipe(uglify())
.pipe(gulp.dest('dist/js'));
});

// Compile Sass
gulp.task('sass', function () {
gulp.src('app/sass/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('dist/css'));
});

// Scripts
gulp.task('scripts', function () {
gulp.src('app/scripts/*.js')
.pipe(concat('app.js'))
.pipe(uglify())
.pipe(gulp.dest('dist/js'));
});

gulp.task('default', ['message', 'copyHtml', 'imageMin', 'sass', 'scripts']);
/*
gulp.task('watch', function () {
gulp.watch('app/scripts/*.js', ['scripts']);
gulp.watch('app/img/*', ['imageMin']);
gulp.watch('app/sass/*.scss', ['sass']);
gulp.watch('app/*.html', ['copyHtml']);
});*/

Loading…
Cancel
Save