Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gruntfile.js tasks...ERROR #19

Open
prudvi opened this issue Aug 4, 2016 · 0 comments
Open

gruntfile.js tasks...ERROR #19

prudvi opened this issue Aug 4, 2016 · 0 comments

Comments

@prudvi
Copy link

prudvi commented Aug 4, 2016

I am using node 5.4

Loading "Gruntfile.js" tasks...ERROR

TypeError: The super constructor to inherits must not be null or undefined.
Warning: Task "default" not found. Use --force to continue.
Aborted due to warnings.

 var LIVERELOAD_PORT = 35729;
 var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
  var mountFolder = function (connect, dir) {
    return connect.static(require('path').resolve(dir));
  };

 var proxySnippet = require('grunt-connect-proxy/lib/utils').proxyRequest;

module.exports = function (grunt) {
    // show elapsed time at the end
    require('time-grunt')(grunt);
    // load all grunt tasks
    require('load-grunt-tasks')(grunt);

    // configurable paths
      var yeomanConfig = {
    app: 'app',
    dist: 'dist'
    };

    grunt.initConfig({
    yeoman: yeomanConfig,
    watch: {
        emberTemplates: {
            files: '<%= yeoman.app %>/templates/**/*.hbs',
            tasks: ['emberTemplates']
        },
        compass: {
            files: ['<%= yeoman.app %>/styles/**/*.{scss,sass}'],
            tasks: ['compass:server']
        },
        neuter: {
            files: ['<%= yeoman.app %>/scripts/**/*.js'],
            tasks: ['neuter']
        },
        livereload: {
            options: {
                livereload: LIVERELOAD_PORT
            },
            files: [
                '.tmp/scripts/*.js',
                '<%= yeoman.app %>/*.html',
                '{.tmp,<%= yeoman.app %>}/styles/**/*.css',
                '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
            ]
        }
    },
    connect: {
        options: {
            port: 8080,
            // change this to '0.0.0.0' to access the server from outside
            hostname: '0.0.0.0'
        },
        proxies: [
            {
                context: '/api',
                host: 'google.com',
                port: 80
            },
            {
                context: '/socket.io',
                host: 'google.io',
                port: 8080
            }
        ],
        livereload: {
            options: {
                middleware: function (connect) {
                    return [
                        lrSnippet,
                        mountFolder(connect, '.tmp'),
                        mountFolder(connect, yeomanConfig.app),
                        proxySnippet
                    ];
                }
            }
        },
        test: {
            options: {
                middleware: function (connect) {
                    return [
                        mountFolder(connect, '.tmp'),
                        mountFolder(connect, 'test'),
                        proxySnippet
                    ];
                }
            }
        },
        dist: {
            options: {
                middleware: function (connect) {
                    return [
                        mountFolder(connect, yeomanConfig.dist),
                        proxySnippet
                    ];
                }
            }
        }
    },
    open: {
        server: {
            path: 'http://localhost:<%= connect.options.port %>'
        }
    },
    clean: {
        dist: {
            files: [{
                dot: true,
                src: [
                    '.tmp',
                    '<%= yeoman.dist %>/*',
                    '!<%= yeoman.dist %>/.git*'
                ]
            }]
        },
        server: '.tmp'
    },
    jshint: {
        options: {
            jshintrc: '.jshintrc'
        },
        all: [
            'Gruntfile.js',
            '<%= yeoman.app %>/scripts/**/*.js',
            '!<%= yeoman.app %>/scripts/vendor/*',
            'test/spec/{,*/}*.js'
        ]
    },
    jasmine: {
        all: {
            /*src: '',*/
            options: {
                specs: 'test/spec/{,*/}*.js'
            }
        }
    },
    compass: {
        options: {
            sassDir: '<%= yeoman.app %>/styles',
            cssDir: '.tmp/styles',
            generatedImagesDir: '.tmp/images/generated',
            imagesDir: '<%= yeoman.app %>/images',
            javascriptsDir: '<%= yeoman.app %>/scripts',
            fontsDir: '<%= yeoman.app %>/styles/fonts',
            importPath: 'app/bower_components',
            httpImagesPath: '/images',
            httpGeneratedImagesPath: '/images/generated',
            httpFontsPath: '/styles/fonts',
            relativeAssets: false,
            specify: '<%= yeoman.app %>/styles/style.scss'
        },
        dist: {
            options: {
                environment: 'production'
            }
        },
        server: {
            options: {
                environment: 'development',
                outputStyle: 'compact'
            }
        }
    },
    // not used since Uglify task does concat,
    // but still available if needed
    /*concat: {
        dist: {}
    },*/
    // not enabled since usemin task does concat and uglify
    // check index.html to edit your build targets
    // enable this task if you prefer defining your build targets here
    uglify: {
        options: {
            compress: {
                // Do not drop unused arguments -- this breaks some Ember bindings
                unused: false
            }
        }
    },
    rev: {
        dist: {
            files: {
                src: [
                    '<%= yeoman.dist %>/scripts/**/*.js',
                    '<%= yeoman.dist %>/styles/**/*.css',
                    '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp}',
                    '<%= yeoman.dist %>/styles/fonts/*'
                ]
            }
        }
    },
    useminPrepare: {
        html: '<%= yeoman.app %>/index.html',
        options: {
            dest: '<%= yeoman.dist %>'
        }
    },
    usemin: {
        html: ['<%= yeoman.dist %>/{,*/}*.html'],
        css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
        options: {
            dirs: ['<%= yeoman.dist %>']
        }
    },
    imagemin: {
        dist: {
            files: [{
                expand: true,
                cwd: '<%= yeoman.app %>/images',
                src: '{,*/}*.{png,jpg,jpeg}',
                dest: '<%= yeoman.dist %>/images'
            }]
        }
    },
    svgmin: {
        dist: {
            files: [{
                expand: true,
                cwd: '<%= yeoman.app %>/images',
                src: '{,*/}*.svg',
                dest: '<%= yeoman.dist %>/images'
            }]
        }
    },
    cssmin: {
        dist: {
            files: {
                '<%= yeoman.dist %>/styles/main.css': [
                    '.tmp/styles/**/*.css',
                    '<%= yeoman.app %>/styles/**/*.css'
                ]
            }
        }
    },
    htmlmin: {
        dist: {
            options: {
                /*removeCommentsFromCDATA: true,
                // https://github.com/yeoman/grunt-usemin/issues/44
                //collapseWhitespace: true,
                collapseBooleanAttributes: true,
                removeAttributeQuotes: true,
                removeRedundantAttributes: true,
                useShortDoctype: true,
                removeEmptyAttributes: true,
                removeOptionalTags: true*/
            },
            files: [{
                expand: true,
                cwd: '<%= yeoman.app %>',
                src: '*.html',
                dest: '<%= yeoman.dist %>'
            }]
        }
    },
    // Put files not handled in other tasks here
    copy: {
        dist: {
            files: [{
                expand: true,
                dot: true,
                cwd: '<%= yeoman.app %>',
                dest: '<%= yeoman.dist %>',
                src: [
                    '*.{ico,txt}',
                    '.htaccess',
                    'images/{,*/}*.{webp,gif,ico}',
                    'styles/fonts/*'
                ]
            }]
        }
    },
    concurrent: {
        server: [
            'emberTemplates',
            'compass:server'
        ],
        test: [
            'emberTemplates',
            'compass'
        ],
        dist: [
            'emberTemplates',
            'compass:dist',
            'imagemin',
            'svgmin',
            'htmlmin'
        ]
    },
    karma: {
        unit: {
            configFile: 'karma.conf.js'
        }
    },
    emberTemplates: {
        options: {
            templateName: function (sourceFile) {
                var templatePath = yeomanConfig.app + '/templates/';
                return sourceFile.replace(templatePath, '');
            }
        },
        dist: {
            files: {
                '.tmp/scripts/compiled-templates.js': '<%= yeoman.app %>/templates/**/*.hbs'
            }
        }
    },
    neuter: {
        app: {
            options: {
                filepathTransform: function (filepath) {
                    return 'app/scripts/' + filepath;
                }
            },
            src: '<%= yeoman.app %>/scripts/app.js',
            dest: '.tmp/scripts/combined-scripts.js'
        }
    }
    });

    grunt.registerTask('server', function (target) {
    if (target === 'dist') {
        return grunt.task.run(['build',
                               'configureProxies',
                               'open',
                               'connect:dist:keepalive'
        ]);
    }

    var tasks = [
        'clean:server',
        'concurrent:server',
        'neuter:app',
        'configureProxies',
        'connect:livereload'
    ];

    if (target !== 'remote') {
        tasks.push('open');
    }

    tasks.push('watch');
    grunt.task.run(tasks);
    });

    grunt.registerTask('test', [
    'clean:server',
    'concurrent:test',
    'configureProxies',
    'connect:test',
    'neuter:app',
    'karma'
    ]);

    grunt.registerTask('build', [
    'clean:dist',
    'useminPrepare',
    'concurrent:dist',
    'neuter:app',
    'concat',
    'cssmin',
    'uglify',
    'copy',
    'rev',
    'usemin'
    ]);

    grunt.registerTask('default', [
    'jshint',
    'test',
    'build'
    ]);
};
`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant