Added static resources
This commit is contained in:
parent
27c032d53f
commit
2806de2a5d
|
@ -0,0 +1,38 @@
|
||||||
|
module.exports = function(grunt) {
|
||||||
|
grunt.initConfig({
|
||||||
|
pkg: grunt.file.readJSON('package.json'),
|
||||||
|
browserify: {
|
||||||
|
dist: {
|
||||||
|
files: {
|
||||||
|
'static/main.js': ['lib/GUI/js/main.js']
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
debug: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
less: {
|
||||||
|
dist: {
|
||||||
|
files: {
|
||||||
|
'static/main.css': ['lib/GUI/css/main.less']
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
sourceMap: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
files: [ "lib/GUI/js/**/*", "lib/GUI/css/**/*"],
|
||||||
|
tasks: [ 'default' ]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
grunt.loadNpmTasks('grunt-browserify');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-less');
|
||||||
|
|
||||||
|
grunt.registerTask('default', [
|
||||||
|
'browserify',
|
||||||
|
'less'
|
||||||
|
]);
|
||||||
|
};
|
|
@ -0,0 +1,3 @@
|
||||||
|
body {
|
||||||
|
|
||||||
|
}
|
|
@ -3,6 +3,8 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>{{ name }}</title>
|
<title>{{ name }}</title>
|
||||||
|
|
||||||
|
<link rel="stylesheet" type="text/css" href="/-/static/main.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1><a href='/'>{{ name }}</a></h1>
|
<h1><a href='/'>{{ name }}</a></h1>
|
||||||
|
@ -26,5 +28,7 @@
|
||||||
<p>{{ description }}</p>
|
<p>{{ description }}</p>
|
||||||
</article>
|
</article>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
|
<script type='text/javascript' src='/-/static/main.js'></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
14
lib/index.js
14
lib/index.js
|
@ -222,6 +222,20 @@ module.exports = function(config_hash) {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Static
|
||||||
|
app.get('/-/static/:file', function(req, res, next) {
|
||||||
|
var file = __dirname + '/static/' + req.params.file;
|
||||||
|
fs.exists(file, function(exists) {
|
||||||
|
if(exists) {
|
||||||
|
res.sendfile(file);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
res.status(404);
|
||||||
|
res.send("File Not Found");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// tagging a package
|
// tagging a package
|
||||||
app.put('/:package/:tag', can('publish'), media('application/json'), function(req, res, next) {
|
app.put('/:package/:tag', can('publish'), media('application/json'), function(req, res, next) {
|
||||||
if (typeof(req.body) !== 'string') return next('route')
|
if (typeof(req.body) !== 'string') return next('route')
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
body {
|
||||||
|
background: blue;
|
||||||
|
}
|
||||||
|
/*# sourceMappingURL=data:application/json,%7B%22version%22%3A3%2C%22sources%22%3A%5B%22lib%2FGUI%2Fcss%2Fmain.less%22%5D%2C%22names%22%3A%5B%5D%2C%22mappings%22%3A%22AAAA%3BEACC%2CgBAAA%22%7D */
|
|
@ -0,0 +1,3 @@
|
||||||
|
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||||
|
|
||||||
|
},{}]},{},[1])
|
|
@ -33,7 +33,12 @@
|
||||||
"fs-ext": ">= 0.3.2"
|
"fs-ext": ">= 0.3.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"browserify": "^3.46.0",
|
||||||
"eslint": ">= 0.4.2",
|
"eslint": ">= 0.4.2",
|
||||||
|
"grunt": "^0.4.4",
|
||||||
|
"grunt-browserify": "^2.0.8",
|
||||||
|
"grunt-contrib-less": "^0.11.0",
|
||||||
|
"grunt-contrib-watch": "^0.6.1",
|
||||||
"mocha": ">= 1.17.0",
|
"mocha": ">= 1.17.0",
|
||||||
"rimraf": ">= 2.2.5"
|
"rimraf": ">= 2.2.5"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue