HTML MVC freamwork

HTML MVC freamwork,
HTML include all pages one page.

===============================
Create HTML MVC Project
================================
RootFolder
--build
--incliude
--base
------footer.html
------header.html
----html-head.html - (include header and footer in this page)
--site
----assets
------css
------js
------images
------fonts
----index.html - (include all pages like header and footer etc..)

================================
site folder : Index.html
================================

include "html-head.html"
include "main.html"
include "html-footer.html"

================================
Create file : Gruntfile.js
================================

module.exports = function(grunt){
  grunt.initConfig({
    clean: {
      build: ['build/']
    },
    // not ready for less yet
    less: {
      build: {
        options: {
          paths: ["less/"]
        },
        files: {
          "site/assets/prod/style.css":"site/assets/less/style.less"
        }
      }
    },
    includes:{
      build: {
        cwd: 'site',
        src: ['*.html'],
        dest: 'build/',
        options: {
          flatten: true,
          includePath: 'include',
          banner: '<!-- Site built using grunt includes -->\n'
        }
      }
    },
    sync:{
      main: {
        files:[
          {
            // Image Files
            expand: true,
            cwd: 'site/images/',
            src: '**/*',
            dest: 'build/images/'
          },{
            expand: true,
            cwd: 'site/css/',
            src: '**/*',
            dest: 'build/css/'
          },{
            expand: true,
            cwd: 'site/assets/',
            src: '**/*',
            dest: 'build/assets/'
          },{
            expand: true,
            cwd: 'site/js/',
            src: '**/*',
            dest: 'build/js/'
          }
        ]
      }
    },
    watch: {
      files: ['site/**/*','include/**/*'],
      tasks: ['build']
    }

  });

  grunt.loadNpmTasks('grunt-includes');
  grunt.loadNpmTasks('grunt-contrib-less');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-sync');
  grunt.loadNpmTasks('grunt-contrib-watch');

  grunt.registerTask('build', [
    'clean',
    'less',
    'includes',
    'sync']);
  grunt.registerTask('default', ['build']);
};


================================
Create file : package.json
================================

{
"name": "Project Name",
"version": "1.0.0",
"homepage": "http://yoursiteName.com",
"author": {
"name": "Author Name",
"url": "http://siteName.com"
},
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-copy": "^0.7.0",
"grunt-contrib-less": "^1.0.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-includes": "^0.4.5",
"grunt-usemin": "^3.0.0"
},
"dependencies": {
"grunt-sync": "^0.4.1"
}
}

Comments

Popular posts from this blog

TypeScrpt basics

font-face HTTPS issue fixes