-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 236cf40
Showing
17 changed files
with
637 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directory | ||
node_modules | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional REPL history | ||
.node_repl_history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: node ./bin/www |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Developer Tools Gadget | ||
An [OU Campus](https://omniupdate.com/products/oucampus) gadget designed for web developers. | ||
|
||
## Features | ||
- Minify/uglify CSS | ||
- Minify/uglify JavaScript | ||
- Compile SCSS | ||
- Compile LESS | ||
|
||
## OU Campus Installation | ||
Follow the OU Campus [gadget installation instructions](http://support.omniupdate.com/oucampus10/setup/gadgets/new-gadget.html) to install this gadget. When prompted for the gadget URL, enter `https://devtools.gadget.host` | ||
|
||
## Installing and running locally | ||
This gadget requires a NodeJS back-end to handle the core functionality. To install, run | ||
``` | ||
git clone https://github.com/lashkari/gadget-devtools.git | ||
cd gadget-devtools | ||
npm install | ||
npm run dev | ||
``` | ||
|
||
## Reporting issues | ||
This is NOT an official gadget. Please report any issues you find here on GitHub, **do not contact OmniUpdate customer support about this gadget**. | ||
|
||
## Contributing | ||
Contributions (by way of pull requests and reporting issues) are very welcome. I've still got some code cleanup to do and then I'll add some more info on how to contribute code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
var express = require('express'); | ||
var path = require('path'); | ||
var favicon = require('serve-favicon'); | ||
var logger = require('morgan'); | ||
var cookieParser = require('cookie-parser'); | ||
var bodyParser = require('body-parser'); | ||
|
||
var jshint = require('./routes/jshint.js'); | ||
var uglify = require('./routes/uglify.js'); | ||
var sass = require('./routes/sass.js'); | ||
var less = require('./routes/less.js'); | ||
|
||
var app = express(); | ||
|
||
app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); | ||
app.use(logger('dev')); | ||
app.use(bodyParser.json({ limit: '1mb' })); | ||
app.use(bodyParser.urlencoded({ extended: false })); | ||
app.use(bodyParser.text()); | ||
app.use(cookieParser()); | ||
app.use(express.static(path.join(__dirname, 'public'))); | ||
|
||
app.use('/', express.static(path.join(__dirname, 'public'))); | ||
app.use('/jshint', jshint); | ||
app.use('/uglify', uglify); | ||
app.use('/sass', sass); | ||
app.use('/less', less); | ||
|
||
// catch 404 and forward to error handler | ||
app.use(function(req, res, next) { | ||
var err = new Error('Not Found'); | ||
err.status = 404; | ||
next(err); | ||
}); | ||
|
||
// error handlers | ||
|
||
// development error handler | ||
// will print stacktrace | ||
if (app.get('env') === 'development') { | ||
app.use(function(err, req, res, next) { | ||
res.status(err.status || 500); | ||
res.render('error', { | ||
message: err.message, | ||
error: err | ||
}); | ||
}); | ||
} | ||
|
||
// production error handler | ||
// no stacktraces leaked to user | ||
app.use(function(err, req, res, next) { | ||
res.status(err.status || 500); | ||
res.render('error', { | ||
message: err.message, | ||
error: {} | ||
}); | ||
}); | ||
|
||
|
||
module.exports = app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#!/usr/bin/env node | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
var app = require('../app'); | ||
var debug = require('debug')('devtoolsGadget:server'); | ||
var http = require('http'); | ||
|
||
/** | ||
* Get port from environment and store in Express. | ||
*/ | ||
|
||
var port = normalizePort(process.env.PORT || '3000'); | ||
app.set('port', port); | ||
|
||
/** | ||
* Create HTTP server. | ||
*/ | ||
|
||
var server = http.createServer(app); | ||
|
||
/** | ||
* Listen on provided port, on all network interfaces. | ||
*/ | ||
|
||
server.listen(port); | ||
server.on('error', onError); | ||
server.on('listening', onListening); | ||
|
||
/** | ||
* Normalize a port into a number, string, or false. | ||
*/ | ||
|
||
function normalizePort(val) { | ||
var port = parseInt(val, 10); | ||
|
||
if (isNaN(port)) { | ||
// named pipe | ||
return val; | ||
} | ||
|
||
if (port >= 0) { | ||
// port number | ||
return port; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
/** | ||
* Event listener for HTTP server "error" event. | ||
*/ | ||
|
||
function onError(error) { | ||
if (error.syscall !== 'listen') { | ||
throw error; | ||
} | ||
|
||
var bind = typeof port === 'string' | ||
? 'Pipe ' + port | ||
: 'Port ' + port; | ||
|
||
// handle specific listen errors with friendly messages | ||
switch (error.code) { | ||
case 'EACCES': | ||
console.error(bind + ' requires elevated privileges'); | ||
process.exit(1); | ||
break; | ||
case 'EADDRINUSE': | ||
console.error(bind + ' is already in use'); | ||
process.exit(1); | ||
break; | ||
default: | ||
throw error; | ||
} | ||
} | ||
|
||
/** | ||
* Event listener for HTTP server "listening" event. | ||
*/ | ||
|
||
function onListening() { | ||
var addr = server.address(); | ||
var bind = typeof addr === 'string' | ||
? 'pipe ' + addr | ||
: 'port ' + addr.port; | ||
debug('Listening on ' + bind); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "devtoolsGadget", | ||
"version": "1.0.0", | ||
"author": "Shahab Lashkari", | ||
"description":"An OU Campus gadget for web developers", | ||
"license": "ISC", | ||
"scripts": { | ||
"start": "node ./bin/www", | ||
"dev": "nodemon ./bin/www" | ||
}, | ||
"engines": { | ||
"node": "5.4.0" | ||
}, | ||
"dependencies": { | ||
"body-parser": "^1.13.3", | ||
"cookie-parser": "~1.3.5", | ||
"debug": "~2.2.0", | ||
"express": "~4.13.1", | ||
"imagemin": "^4.0.0", | ||
"jshint": "^2.9.1", | ||
"less": "^2.6.0", | ||
"morgan": "~1.6.1", | ||
"node-sass": "^3.4.2", | ||
"serve-favicon": "~2.3.0", | ||
"uglify-js": "^2.6.1", | ||
"uglifycss": "0.0.20" | ||
}, | ||
"devDependencies": { | ||
"nodemon": "^1.9.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
|
||
<config> | ||
<!-- The title that appears in the gadget's title bar. --> | ||
<entry key="title" label="Title">Developer Tools</entry> | ||
|
||
<!-- The URL of an icon image. --> | ||
<entry key="icon" private="true">https://devtools.gadget.host/favicon.ico</entry> | ||
|
||
<!-- The description that appears in the gadget chooser. --> | ||
<entry key="description" private="true">Provides useful tools for web developers. Currently supports minification of CSS/JavaScript and CSS pre-processing of SASS and LESS.</entry> | ||
|
||
<!-- The URL of a thumbnail image to appear in the gadget chooser. --> | ||
<entry key="thumbnail" private="true">https://devtools.gadget.host/images/thumbnail.png</entry> | ||
|
||
<!-- Current supported types are "dashboard" and "sidebar". If you want your gadget to appear | ||
in both places, enter "dashboard, sidebar". --> | ||
<entry key="types" private="true">sidebar</entry> | ||
|
||
<!-- This entry, if present, causes OU Campus to forward notifications of the specified | ||
type(s) to the gadget. Enter one or more notification types separated by commas. --> | ||
<entry key="notifications" private="true">view_changed</entry> | ||
|
||
<!-- For sidebar gadgets only. See explanation at bottom. --> | ||
<entry key="sidebar_context" private="true">page</entry> | ||
|
||
<!-- For sidebar gadgets only. Determines the initial height of the gadget in pixels. --> | ||
<entry key="initial_height" private="true">80</entry> | ||
|
||
</config> |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.