Skip to content

Commit 9cdb2cf

Browse files
committed
Merge pull request #35 from mrjoelkemp/no-cache
Fixes
2 parents 26b8b43 + eb116b2 commit 9cdb2cf

26 files changed

+104
-148
lines changed

.jshintrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
"mocha" : true,
99
"globals" : {
1010
"window": false,
11-
"document": false
11+
"document": false,
12+
"$": false,
13+
"moment": false
1214
}
1315
}

Gruntfile.js

Lines changed: 73 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,85 @@
11
module.exports = function (grunt) {
2-
var path = require('path'),
3-
fs = require('fs');
2+
var path = require('path'),
3+
fs = require('fs');
44

5-
require('load-grunt-tasks')(grunt);
5+
require('load-grunt-tasks')(grunt);
66

7-
grunt.initConfig({
8-
"sass": {
9-
"dist": {
10-
"files": [
11-
{
12-
"expand": true,
13-
"src": [
14-
"**/*.{scss, sass}",
15-
"!node_modules/**/*.{scss, sass}"
16-
],
17-
"ext": ".css"
18-
}
19-
]
20-
}
7+
grunt.initConfig({
8+
cacheBust: {
9+
options: {
10+
deleteOriginals: true
2111
},
22-
"browserify": {
23-
"dist": {
24-
"files": {
25-
"dist/phpepl.js": ["src/phpepl.js"]
12+
assets: {
13+
files: [{
14+
src: ['index.html']
15+
}]
16+
}
17+
},
18+
sass: {
19+
dist: {
20+
files: [
21+
{
22+
expand: true,
23+
src: [
24+
"**/*.{scss, sass}",
25+
"!node_modules/**/*.{scss, sass}"
26+
],
27+
ext: ".css"
2628
}
27-
}
29+
]
30+
}
31+
},
32+
browserify: {
33+
options: {
34+
exclude: [
35+
'js/vendor/jquery-2.1.3.min.js',
36+
'js/vendor/moment.min.js'
37+
]
2838
},
29-
"uglify": {
30-
"options": {
31-
"sourceMap": true,
32-
"sourceMapIncludeSources": true
33-
},
34-
"dist": {
35-
"files": {
36-
"dist/phpepl.js": ['dist/phpepl.js']
37-
}
39+
dist: {
40+
files: {
41+
"dist/phpepl.js": ["js/phpepl.js"]
3842
}
43+
}
44+
},
45+
uglify: {
46+
options: {
47+
sourceMap: true,
48+
sourceMapIncludeSources: true
3949
},
40-
"watch": {
41-
"sass": {
42-
"files": [
43-
"**/*.scss",
44-
"!node_modules/**/*.scss",
45-
"!.git/**/*.scss",
46-
"!.sass-cache/**/*.scss",
47-
"!bower_components/**/*.scss",
48-
"!vendor/**/*.scss"
49-
],
50-
"tasks": [
51-
"newer:sass"
52-
]
53-
},
54-
"js": {
55-
"files": [
56-
"src/**/*.js"
57-
],
58-
"tasks": [
59-
"browserify",
60-
"uglify"
61-
]
62-
},
63-
"all": {
64-
"files": [
65-
"**/*",
66-
"!node_modules/**/*",
67-
"!.git/**/*",
68-
"!.sass-cache/**/*",
69-
"!bower_components/**/*",
70-
"!vendor/**/*"
71-
],
72-
"tasks": [
73-
"noop"
74-
],
75-
"options": {
76-
"cwd": "./",
77-
"spawn": false,
78-
"event": [
79-
"added"
80-
]
81-
}
50+
dist: {
51+
files: {
52+
"dist/phpepl.js": ['dist/phpepl.js']
8253
}
8354
}
84-
});
85-
86-
grunt.registerTask('default', ['watch']);
87-
88-
// Handle new files with that have a new, supported preprocessor
89-
grunt.event.on('watch', function(action, filepath) {
90-
var ext = path.extname(filepath);
91-
92-
// Ignore directories
93-
if (fs.lstatSync(filepath).isDirectory()) return;
94-
95-
if (action === 'added') {
96-
// This is a special message that's parsed by YA
97-
// to determine if support for an additional preprocessor is necessary
98-
// Note: this allows us to avoid controlling grunt manually within YA
99-
console.log('EXTADDED:' + ext);
100-
101-
// Note: we don't do anything for newly added .js files
102-
// A new js file can't be the root unless it's changed to require
103-
// the current root and saved/changed
104-
} else if (action === 'changed' || action === 'deleted') {
105-
if (ext === '.js') {
106-
// Ignore bundles
107-
if (/.+bundle.js/g.test(filepath)) return;
108-
109-
// Notify YA to recompute the roots and
110-
// generate a configuration
111-
console.log('JSCHANGED:' + filepath);
112-
}
55+
},
56+
watch: {
57+
sass: {
58+
files: [
59+
"**/*.scss",
60+
"!node_modules/**/*.scss",
61+
"!.git/**/*.scss",
62+
"!.sass-cache/**/*.scss",
63+
"!bower_components/**/*.scss",
64+
"!vendor/**/*.scss"
65+
],
66+
tasks: [
67+
"newer:sass"
68+
]
69+
},
70+
js: {
71+
files: [
72+
"js/**/*.js",
73+
"!js/vendor/**/*.js"
74+
],
75+
tasks: [
76+
"browserify",
77+
"uglify",
78+
'cacheBust'
79+
]
11380
}
114-
});
81+
}
82+
});
11583

116-
// For watching entire directories but allowing
117-
// the grunt.event binding to take care of it
118-
grunt.registerTask('noop', function () {});
119-
}
84+
grunt.registerTask('default', ['watch']);
85+
}

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ If you'd like to tinker around with the code, you can do the following:
6969
* `grunt`
7070
* Point your browser to your localhost (assuming you have the app being [served locally](#running-it-locally))
7171

72-
`src/phpepl.js` is the main script for the website. This gets built into `dist/phpepl.js`
73-
which is referenced by `phpepl/index.html`.
72+
`js/phpepl.js` is the main script for the website. This gets built into a hashed `dist/phpepl.js`
73+
which is referenced by `index.html`.
7474

75-
The php evaluation code is in `src/eval/index.php`.
75+
The php evaluation code is in `eval/index.php`.
7676

7777
That endpoint checks for the existence of a `PHPEPL_PROD` environment variable
7878
(which is set on the production hosts) for sandboxing. Locally, you won't
File renamed without changes.

dist/phpepl.6dea5a8de69bec15.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/phpepl.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

dist/phpepl.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/eval/index.php renamed to eval/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Only production environments will have this set – turning on sandboxing
33
// DEP_VERSION is for cloud control
44
$sandbox_me = isset($_ENV['PHPEPL_PROD']) || isset($_ENV['DEP_VERSION']);
5-
require_once('../../vendor/autoload.php');
5+
require_once('../vendor/autoload.php');
66

77
// Turn off errors since eval will throw them on invalid syntax
88
@ini_set('log_errors', false);

favicon.a7a02ef2032fea1a.ico

1.37 KB
Binary file not shown.

favicon.ico

-1.12 KB
Binary file not shown.

0 commit comments

Comments
 (0)