Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Diethelm committed Jan 28, 2014
2 parents dde9363 + 772aa4f commit 11b7bc7
Show file tree
Hide file tree
Showing 28 changed files with 559 additions and 241 deletions.
16 changes: 13 additions & 3 deletions CHANGELOG.md
@@ -1,12 +1,22 @@
# Changelog

## develop branch (0.8.0-beta2)
## develop branch (0.9.0)

-

## 0.8.0-beta3

- This release contains breaking changes.
- Additional config / build rewrite, allows complete flexibility for frontend sources and build destinations, even outside of xtc root. All relative paths are resolved to absolute paths. xtc can now be used as a Terrific build tool in foreign frameworks.

## 0.8.0-beta2

- Fix missing dependencies that resulted from gitignoring too aggressively.


## develop branch (0.8.0-beta1)
## 0.8.0-beta1

- This release contains breaking changes.
- Use Hipsum.js for easy filler text. Available in development and production installations.
- Use grunt-glue-nu for improved glue spriting the grunt way
- Full logging in production, including date and user agent.
Expand All @@ -18,7 +28,7 @@
- Handlebars helpers are now automatically registered for use in module templates.
- Views in the project overview are now rendered using the catch-all route. This prevents conflicts with with ‘raw’ & ‘solo’ `_view` routes if the dev adds custom routes to the views that include queries.
- "Pin" views to the top in the project overview by writing view names in a json file in _config/.
- Default asset build now goes writes `build` dir (not tracked by git) and does not minify anymore. Start grunt with `--dist` option to start a production build including minification into `dist` dir (tracked by git).
- Default asset build now writes into `build` dir (not tracked by git) and does not minify anymore. Start grunt with `--dist` option to start a production build, including minification, into `dist` dir (tracked by git).
- Improved formatting of rendered modules. Auto-indent nested modules. You can manually specify the desired indentation on module and inline asset calls.
- Refactored a lot of application code for clarity and better separation of components.
- Using [node-convict](https://github.com/mozilla/node-convict) for configuration building and switched to [CJSON](https://github.com/kof/node-cjson) config files. Convict supports environment variables and validation of config values.
Expand Down
83 changes: 46 additions & 37 deletions Gruntfile.js
@@ -1,11 +1,13 @@
module.exports = function(grunt) {

process.env.NODE_ENV = grunt.option('dist') ? 'production' : 'development';

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Read project configuration

var path = require('path')
,configr = require('./lib/configure')
,cfg ,modulesPattern, buildBasePath, buildBaseDirName
,cfg ,modulesPattern, buildPath, buildBaseDirName
,isDistBuild = grunt.option('dist') || false // based on this value we will execute a dev or dist build
;

Expand All @@ -23,48 +25,45 @@ module.exports = function(grunt) {
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Create vars from config

modulesPattern = path.join(cfg.paths.modulesBaseDir, cfg.moduleDirName.replace('{{name}}', '*'))
buildBaseDirName = isDistBuild ? cfg.static.build.baseDirNameDist : cfg.static.build.baseDirNameDev;
buildBasePath = isDistBuild
? path.join(cfg.paths.staticBaseDir, cfg.static.build.baseDirNameDist) // build.baseDirNameDist can be empty
: path.join(cfg.paths.staticBaseDir, cfg.static.build.baseDirNameDev) // build.baseDirNameDev can be empty
;
modulesPattern = path.join(cfg.sources.modulesBaseDir, cfg.moduleDirName.replace('{{name}}', '*'))
buildBaseDirName = isDistBuild ? cfg.build.baseDirNameDist : cfg.build.baseDirNameDev;
buildPath = path.join(cfg.buildBasePath, buildBaseDirName); // build.baseDirName can be empty


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Define grunt config

grunt.initConfig({

pkg : grunt.file.readJSON('package.json')
pkg : require('./package.json')

,staticUriPrefixCss : cfg.staticUriPrefix
,staticUriPrefix : (cfg.staticUriPrefix || '') + '/'
,staticBaseUriCss : cfg.staticBaseUri
,staticBaseUri : (cfg.staticBaseUri || '') + '/'


////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Sources base paths

,tcInline : cfg.paths.inline
,tcBase : cfg.paths.base
,tcInline : cfg.sources.inline
,tcBase : cfg.sources.base
,spritesPath : '<%=tcBase%>/css/sprites'
,tcModules : modulesPattern
,tcApplication : cfg.paths.application
,staticDir : cfg.paths.staticBaseDir
,tcApplication : cfg.sources.application
,staticDir : cfg.staticPath


////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Output destinations

,baseDirName : cfg.static.build.baseDirName
,buildBasePath : buildBasePath // dynamic, depends on build mode (development/production)
,buildBaseDirName : buildBaseDirName // dynamic, depends on build mode (development/production)
,tmpPath : '<%=buildBasePath%>/tmp'
//,baseDirName : cfg.build.baseDirName

,buildPath : buildPath // dynamic, depends on build mode (development/production)
//,buildBaseDirName : buildBaseDirName // dynamic, depends on build mode (development/production)
,tmpPath : '<%=buildPath%>/tmp'

,destJs : '<%=buildBasePath%>'
,destCss : '<%=buildBasePath%>'
,destSpritesImg : '<%=buildBasePath%>'
,destJs : '<%=buildPath%>'
,destCss : '<%=buildPath%>'
,destSpritesImg : '<%=buildPath%>'
,destSpritesCss : '<%=spritesPath%>' // technically this should go in tmp, but we want the generated classes in our base css for easy lookup.


Expand Down Expand Up @@ -102,7 +101,7 @@ module.exports = function(grunt) {
,'<%=tcApplication%>/js/*.js'
]
,module_test_js: [
'<%=staticDir%>/test/*.js'
'<%=staticDir%>/lib/test/*.js'
,'<%=tcModules%>/test/*.js'
]
,jshint_inline: [
Expand Down Expand Up @@ -132,7 +131,7 @@ module.exports = function(grunt) {
options: {
css : '<%=destSpritesCss%>'
,less : true
,url : '<%=staticUriPrefix%><%=buildBaseDirName%>'
,url : '<%=staticBaseUri%><%=buildBaseDirName%>'
,namespace : ''
,'sprite-namespace' : ''
,optipng : true
Expand Down Expand Up @@ -193,7 +192,7 @@ module.exports = function(grunt) {
,less: {
inline: {
options: {
// cssmin will not create file if the output is empty. a special comment fixes this.
// cssmin will not create file if the output is empty. a special comment fixes this.
banner : '/*! Inline style dependencies for page bootstrapping */'
,imports: {
reference : ['<%=tcInline%>/css/lib/reference/*.less']
Expand All @@ -204,9 +203,10 @@ module.exports = function(grunt) {
}
,external: {
options: {
banner : "@static-prefix: '<%=staticUriPrefixCss%>';"
banner : "@static-prefix: '<%=staticBaseUriCss%>';"
,imports: {
reference : ['<%=tcBase%>/css/lib/reference/*.less']
//reference : ['<%=tcBase%>/css/lib/reference/*.less']
reference : [path.relative(process.cwd(), cfg.sources.base +'/css/lib/reference')+'/*.less']
}
}
,src : '<%=tmpPath%>/external-imports.less'
Expand All @@ -227,13 +227,18 @@ module.exports = function(grunt) {

// After dist build remove all non-minified files.
,clean: {
dist: [
'<%=tmpPath%>'
,'<%=destCss%>/inline.css'
,'<%=destCss%>/external.css'
,'<%=destJs%>/inline.js'
,'<%=destJs%>/external.js'
]
dist: {
options: {
force: true
}
,src: [
'<%=tmpPath%>'
,'<%=destCss%>/inline.css'
,'<%=destCss%>/external.css'
,'<%=destJs%>/inline.js'
,'<%=destJs%>/external.js'
]
}
}

,jshint: {
Expand Down Expand Up @@ -290,7 +295,11 @@ module.exports = function(grunt) {
}

,watch: {
sprites: {
options: {
//cwd : '../..',
spawn : false
}
,sprites: {
files : ['<%=sources.sprites_watch%>']
,tasks : ['build-sprites', 'build-external-css']
},
Expand Down Expand Up @@ -339,7 +348,7 @@ module.exports = function(grunt) {
// Define build tasks // use actual task name (first part before colon)!

grunt.registerTask('build-sprites', ['glue']);
grunt.registerTask('build-external-js', ['concat:external_scripts', 'jshint:external',]);
grunt.registerTask('build-external-js', ['concat:external_scripts', 'jshint:external']);
grunt.registerTask('build-inline-js', ['concat:inline_scripts', 'log:devJsDone', 'jshint:inline']);
grunt.registerTask('build-external-css', ['less_imports:external', 'less:external']);
grunt.registerTask('build-inline-css', ['less_imports:inline', 'less:inline', 'log:devCssDone']);
Expand Down Expand Up @@ -400,7 +409,7 @@ module.exports = function(grunt) {

grunt.registerMultiTask('log', 'a console logging task', function() {
var options = this.options()
,color = options.color || false
,color = options.color || false
;

if (options.bold) {
Expand Down
5 changes: 2 additions & 3 deletions README.md
@@ -1,6 +1,5 @@
<sup>Master</sup> [![Build status (master)](http://b.adge.me/travis/MarcDiethelm/xtc/master.svg)](https://travis-ci.org/MarcDiethelm/xtc) &nbsp; <sup>Develop</sup> [![Build status (develop)](http://b.adge.me/travis/MarcDiethelm/xtc/develop.svg)](https://travis-ci.org/MarcDiethelm/xtc) &nbsp;&nbsp; ![MIT license](http://b.adge.me/:license-MIT-brightgreen.svg) &nbsp;&nbsp; [![Follow @xtcjs](http://b.adge.me/:@xtcjs-follow-green.svg)](https://twitter.com/xtcjs) &nbsp;&nbsp; [![gittip donate](http://b.adge.me/:gittip-donate-lightgrey.svg)](https://www.gittip.com/MarcDiethelm/)
<sup>Master</sup>&nbsp;[![Build status (master)](http://b.adge.me/travis/MarcDiethelm/xtc/master.svg)](https://travis-ci.org/MarcDiethelm/xtc) &nbsp; <sup>Develop</sup>&nbsp;[![Build status (develop)](http://b.adge.me/travis/MarcDiethelm/xtc/develop.svg)](https://travis-ci.org/MarcDiethelm/xtc) &nbsp;&nbsp; ![MIT license](http://b.adge.me/:license-MIT-brightgreen.svg) &nbsp;&nbsp; [![Follow @xtcjs](http://b.adge.me/:@xtcjs-follow-green.svg)](https://twitter.com/xtcjs) &nbsp;&nbsp; [![gittip donate](http://b.adge.me/:gittip-donate-lightgrey.svg)](https://www.gittip.com/MarcDiethelm/)

---

# xtc <small>– frontend development server and framework</small>

Expand Down Expand Up @@ -155,7 +154,7 @@ The configuration files are located the folder `_config`.
`config-local.json` is also listed in `.jitsuignore`, so if you're using Nodejitsu for hosting this file will never be
deployed. Make sure these two files are not tracked by git unless you know what you're doing.

The location of the config files can be configured in package.json.
Which config files are loaded and their order can be configured in configs.json. The location of the config files can be configured in package.json by changing the `configPath` property.


### Start the Server!
Expand Down

0 comments on commit 11b7bc7

Please sign in to comment.