Skip to content

Commit

Permalink
add grunt-targethtml to conditionally use brackets less/css based on …
Browse files Browse the repository at this point in the history
…dev/dist build.
  • Loading branch information
jasonsanjose committed Nov 1, 2013
1 parent fabd7b0 commit f51764b
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Thumbs.db

# ignore compiled files
/dist
/src/.index.html
/src/styles/brackets.css

# ignore everything in the dev extension directory EXCEPT the README
Expand Down
31 changes: 26 additions & 5 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = function (grunt) {
'use strict';

// load dependencies
require('load-grunt-tasks')(grunt, {pattern: ['grunt-contrib-*', 'grunt-usemin']});
require('load-grunt-tasks')(grunt, {pattern: ['grunt-contrib-*', 'grunt-targethtml', 'grunt-usemin']});
grunt.loadTasks('tasks');

var common = require("./tasks/lib/common")(grunt);
Expand All @@ -34,11 +34,23 @@ module.exports = function (grunt) {
grunt.initConfig({
pkg : grunt.file.readJSON("package.json"),
clean: {
dist: ['dist']
dist: {
files: [{
dot: true,
src: [
'dist',
'src/.index.html',
'src/styles/brackets.css'
]
}]
}
},
copy: {
dist: {
files: [
{
'dist/index.html': 'src/.index.html'
},
/* static files */
{
expand: true,
Expand All @@ -49,7 +61,8 @@ module.exports = function (grunt) {
'nls/{,*/}*.js',
'xorigin.js',
'dependencies.js',
'thirdparty/requirejs/require.js'
'thirdparty/requirejs/require.js',
'LiveDevelopment/launch.html'
]
},
/* extensions and CodeMirror modes */
Expand Down Expand Up @@ -108,11 +121,18 @@ module.exports = function (grunt) {
}
}
},
targethtml: {
dist: {
files: {
'src/.index.html': 'src/index.html'
}
}
},
useminPrepare: {
options: {
dest: 'dist'
},
html: 'src/index.html'
html: 'src/.index.html'
},
usemin: {
options: {
Expand Down Expand Up @@ -272,8 +292,9 @@ module.exports = function (grunt) {
// Default task.
grunt.registerTask('default', [
'test',
'less',
'clean',
'less',
'targethtml',
'useminPrepare',
'htmlmin',
'requirejs',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"grunt-contrib-uglify": "0.2.0",
"grunt-contrib-concat": "0.3.0",
"grunt-contrib-watch": "0.4.3",
"grunt-targethtml": "0.2.6",
"grunt-usemin": "0.1.11",
"load-grunt-tasks": "0.2.0",
"q": "0.9.2",
Expand Down
1 change: 0 additions & 1 deletion src/brackets.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,5 @@ define(function (require, exports, module) {
// Dispatch htmlReady event
_beforeHTMLReady();
AppInit._dispatchReady(AppInit.HTML_READY);

$(window.document).ready(_onReady);
});
1 change: 1 addition & 0 deletions src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"grunt-contrib-requirejs": "0.4.1",
"grunt-contrib-uglify": "0.2.0",
"grunt-contrib-concat": "0.3.0",
"grunt-targethtml": "0.2.6",
"grunt-usemin": "0.1.11",
"load-grunt-tasks": "0.2.0",
"q": "0.9.2",
Expand Down
8 changes: 6 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@
<!-- NOTE: All scripts must be external for Chrome App support: http://developer.chrome.com/apps/app_csp.html -->

<!-- Warn about failed cross origin requests in Chrome -->
<script type="application/javascript" src="xorigin.js">
</script>
<script type="application/javascript" src="xorigin.js"></script>

<!-- build:css styles/brackets.min.css -->
<link rel="stylesheet" type="text/css" href="thirdparty/CodeMirror2/lib/codemirror.css">
<!--(if target dev)><!-->
<link rel="stylesheet" type="text/less" href="styles/brackets.less">
<!--<!(endif)-->
<!--(if target dist)>
<link rel="stylesheet" type="text/css" href="styles/brackets.css">
<!--<!(endif)-->
<!-- endbuild -->

<!-- JavaScript -->
Expand Down

0 comments on commit f51764b

Please sign in to comment.