heavymery / grunt-require-rev

[OOD] File revisioning for RequireJS dependencies.
MIT License
1 stars 3 forks source link

There are no changes in the configuration file RequireJS #5

Closed jefferson-william closed 8 years ago

jefferson-william commented 8 years ago

gruntfile.js

module.exports = function(grunt) {
    require('logfile-grunt')(grunt);
    grunt.initConfig({
        requireRev: {
            dist: {
                options: {
                    hash: {
                        algorithm: 'sha1',
                        length: 16
                    },
                    paths: {
                        styles: 'css!dist/app/assets/styles/' // for requireCSS
                    }
                },
                expand: true,
                cwd: 'dist/app',
                src: [
                    'assets/**/*.js',
                    'assets/**/*.css'
                ]
            }
        }
    });
    grunt.loadNpmTasks('grunt-require-rev');
    grunt.registerTask('rev', ['requireRev:dist']);
};

Before:

File structure:

+- dist
|   +- app
|       +- assets
|           +- main.js
|           +- scripts
|               +- app.js
|               +- controllers
|                  +- main.js
|           +- styles
|               +- main.css

File that contains the settings RequireJS:


    /*jshint unused: vars */
    require.config({
        map: {
            '*': {
                css: './assets/bower_components/require-css/css.js'
            }
        },
        paths: {
            bootstrap: './bower_components/bootstrap/dist/js/bootstrap',
            fontAwesomeCss: './bower_components/fontawesome/css/font-awesome',
            app: './scripts/app',
            mainCss: './styles/main',

            mainController: './scripts/controllers/main',

            angular: './bower_components/angular/angular',
            angularRoute: './bower_components/angular-route/angular-route',
            angularCookies: './bower_components/angular-cookies/angular-cookies',
            angularSanitize: './bower_components/angular-sanitize/angular-sanitize',
            angularResource: './bower_components/angular-resource/angular-resource',
            angularAnimate: './bower_components/angular-animate/angular-animate',
            angularTouch: './bower_components/angular-touch/angular-touch',
            angularAria: './bower_components/angular-aria/angular-aria',
            angularMocks: './bower_components/angular-mocks/angular-mocks',

            angularMaterial: './bower_components/angular-material/angular-material',
            angularMaterialCss: './bower_components/angular-material/angular-material',
            angularMaterialLayoutsCss: './bower_components/angular-material/angular-material.layouts'
        },
        shim: {
            angular: {
                exports: 'angular'
            },
            angularRoute:   ['angular'],
            angularCookies: ['angular'],
            angularSanitize:['angular'],
            angularResource:['angular'],
            angularAnimate: ['angular'],
            angularTouch:   ['angular'],
            angularAria:    ['angular'],
            angularMaterial:['angular'],
            angularMocks: {
                deps: ['angular'],
                exports: 'angular.mock'
            },
        },
        priority: [
            'angular'
        ],
        packages: [

        ]
    });

    //http://code.angularjs.org/1.2.1/docs/guide/bootstrap#overview_deferred-bootstrap
    window.name = 'NG_DEFER_BOOTSTRAP!';

    define([
        'angular',
        'angularRoute',
        'angularCookies',
        'angularSanitize',
        'angularResource',
        'angularAnimate',
        'angularTouch',
        'angularAria',
        'angularMaterial',
        'mainController',
        'dist/app/assets/scripts/app.js',
    ], function(angular, ngRoutes, ngCookies, ngSanitize, ngResource, ngAnimate, ngTouch, ngAria, ngMaterial, mainController, app) {
        'use strict';

        /* jshint ignore:start */
        var $html = angular.element(document.getElementsByTagName('html')[0]);
        /* jshint ignore:end */

        angular.element().ready(function() {
            angular.resumeBootstrap([app.name]);
        });
    });

After

+- dist
|   +- app
|       +- assets
|           +- 411e34df591f0723.main.js
|           +- scripts
|               +- 7c3a39ac841323f0.app.js
|               +- controllers
|                  +- 383bd1e8e264a206.main.js
|           +- styles
|               +- d0e31ef5465c9e2b.main.css

File that contains the settings RequireJS:


    /*jshint unused: vars */
    require.config({
        map: {
            '*': {
                css: './assets/bower_components/require-css/css.js'
            }
        },
        paths: {
            bootstrap: './bower_components/bootstrap/dist/js/bootstrap',
            fontAwesomeCss: './bower_components/fontawesome/css/font-awesome',
            app: './scripts/app',
            mainCss: './styles/main',

            mainController: './scripts/controllers/main',

            angular: './bower_components/angular/angular',
            angularRoute: './bower_components/angular-route/angular-route',
            angularCookies: './bower_components/angular-cookies/angular-cookies',
            angularSanitize: './bower_components/angular-sanitize/angular-sanitize',
            angularResource: './bower_components/angular-resource/angular-resource',
            angularAnimate: './bower_components/angular-animate/angular-animate',
            angularTouch: './bower_components/angular-touch/angular-touch',
            angularAria: './bower_components/angular-aria/angular-aria',
            angularMocks: './bower_components/angular-mocks/angular-mocks',

            angularMaterial: './bower_components/angular-material/angular-material',
            angularMaterialCss: './bower_components/angular-material/angular-material',
            angularMaterialLayoutsCss: './bower_components/angular-material/angular-material.layouts'
        },
        shim: {
            angular: {
                exports: 'angular'
            },
            angularRoute:   ['angular'],
            angularCookies: ['angular'],
            angularSanitize:['angular'],
            angularResource:['angular'],
            angularAnimate: ['angular'],
            angularTouch:   ['angular'],
            angularAria:    ['angular'],
            angularMaterial:['angular'],
            angularMocks: {
                deps: ['angular'],
                exports: 'angular.mock'
            },
        },
        priority: [
            'angular'
        ],
        packages: [

        ]
    });

    //http://code.angularjs.org/1.2.1/docs/guide/bootstrap#overview_deferred-bootstrap
    window.name = 'NG_DEFER_BOOTSTRAP!';

    define([
        'angular',
        'angularRoute',
        'angularCookies',
        'angularSanitize',
        'angularResource',
        'angularAnimate',
        'angularTouch',
        'angularAria',
        'angularMaterial',
        'mainController',
        'dist/app/assets/scripts/app.js',
    ], function(angular, ngRoutes, ngCookies, ngSanitize, ngResource, ngAnimate, ngTouch, ngAria, ngMaterial, mainController, app) {
        'use strict';

        /* jshint ignore:start */
        var $html = angular.element(document.getElementsByTagName('html')[0]);
        /* jshint ignore:end */

        angular.element().ready(function() {
            angular.resumeBootstrap([app.name]);
        });
    });

As you can see, there were no changes in main.js file - containing RequireJS settings and links to other files - after running the task grunt rev.

I am available every day to assist you in solving my case. :)

Grateful!

heavymery commented 8 years ago

@jefferson-william Sorry for late response :wink: I have a question about your file structure. Where is file that contains setting?

+- dist
|   +- app
|       +- assets
|           +- main.js // <- this file?
heavymery commented 8 years ago

@jefferson-william I found bug and fix that. Please update to v0.1.3 and try again.

jefferson-william commented 8 years ago

@heavymery Yes, the assets/main.js file is what contains the settings.

Thank you! I will update. ;)