Skip to content

Commit

Permalink
Necessary changes
Browse files Browse the repository at this point in the history
Changes in README file
Watching any css file inside styles folder in gulpfile.js
Changing ecstatic version in package.json
  • Loading branch information
krman009 committed Apr 27, 2019
1 parent 95147d2 commit 2b7d1db
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 33 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
## [Daily-Task](https://krman009.github.io/Daily-Task/)

##### 2015 by [Kaushalya Mandaliya](https://twitter.com/kmandalwala "@kmandalwala") | http://seebeetee.com
##### 2019 by [Kaushalya Mandaliya](https://twitter.com/kmandalwala "@kmandalwala") | https://seebeetee.com

---

+ Live Server:
+ Open up your **terminal/command prompt/command line.**
+ Navigate to the **Daily-Task directory.**
+ *Type `npm install` to install `devDependencies`.
+ *Then type `gulp` and press `Enter` and wait for some seconds.
+ And There should be a live server at [http://localhost:9999](http://localhost:9999).

> *Note: Make sure that you have installed the [node.js](http://nodejs.org) and [gulpjs](http://gulpjs.com/) on your machine. (If you've not, don't worry I've written little guide below. :))
> *Note: Make sure that you've installed the [node.js](http://nodejs.org) and [gulpjs](http://gulpjs.com/) on your machine. (I've written little guide below in case you've not already)
---

Expand All @@ -18,7 +20,7 @@ Installing `node.js`:
+ To install [node.js](http://nodejs.org):
+ Just download it from [nodejs.org](http://nodejs.org) and install it.

Installing `gulpjs`: [when you hit `npm install`, gulp will be installed in present directory]
Installing `gulpjs`: [when you hit `npm install`, gulp will be installed in current directory]

+ To install [gulpjs](http://gulpjs.com) globally: [First, Make sure you've installed `nodejs`.]
+ Type below command in your `command line` and press `Enter`
Expand All @@ -33,5 +35,6 @@ Installing `gulpjs`: [when you hit `npm install`, gulp will be installed in pres
<sup>\[1\]</sup> As tested in **Windows 8**, The `gulp` command isn't working without installing it globally.

---

## [LICENSE](https://github.com/krman009/Daily-Task/blob/master/LICENSE)
MIT (c) Kaushalya Mandaliya
52 changes: 24 additions & 28 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,49 @@ var gulp = require('gulp');
var EXPRESS_PORT = 9999;
var EXPRESS_ROOT = __dirname;
var LIVERELOAD_PORT = 35729;
var colors = require('colors');

// Let's make things more readable by
// encapsulating each part's setup
// in its own method
function startExpress() {

var express = require('express');
var app = express();
app.use(require('connect-livereload')());
app.use(express.static(EXPRESS_ROOT));
app.listen(EXPRESS_PORT);
var express = require('express');
var app = express();
app.use(require('connect-livereload')());
app.use(express.static(EXPRESS_ROOT));
app.listen(EXPRESS_PORT);
}

// We'll need a reference to the tinylr
// object to send notifications of file changes
// further down
var lr;
function startLivereload() {

lr = require('tiny-lr')();
lr.listen(LIVERELOAD_PORT);
lr = require('tiny-lr')();
lr.listen(LIVERELOAD_PORT);
}

// Notifies livereload of changes detected
// by `gulp.watch()`
function notifyLivereload(event) {

// `gulp.watch()` events provide an absolute path
// so we need to make it relative to the server root
var fileName = require('path').relative(EXPRESS_ROOT, event.path);

lr.changed({
body: {
files: ['index.html']
}
});
// `gulp.watch()` events provide an absolute path
// so we need to make it relative to the server root
var fileName = require('path').relative(EXPRESS_ROOT, event.path);

console.log('Reloaded!'.cyan)
lr.changed({
body: {
files: [fileName]
}
});

console.log(fileName, 'saved and', 'browser Reloaded!'.cyan)
}

// Default task that will be run
// when no parameter is provided
// to gulp
gulp.task('default', function () {

startExpress();
startLivereload();
gulp.watch('*.html', notifyLivereload);
startExpress();
startLivereload();
gulp.watch('*.html', notifyLivereload);
gulp.watch('styles/*.css', notifyLivereload);
});
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"devDependencies": {
"colors": "^1.0.3",
"connect-livereload": "^0.5.0",
"ecstatic": "^0.5.6",
"ecstatic": "^2.0.0",
"express": "^4.10.2",
"gulp": "^3.8.10",
"gulp-livereload": "^2.1.1",
"http": "0.0.0",
"tiny-lr": "^0.1.4"
}
}
}

0 comments on commit 2b7d1db

Please sign in to comment.