V
V
Vyacheslav Lebedev2015-01-26 10:08:47
Grunt.js
Vyacheslav Lebedev, 2015-01-26 10:08:47

Why don't scripts work when building a project on Grunt?

Good morning! :)
I collect the project with the help of soil.
But when you run the collected files, the scripts refuse to work.
It sticks together in my opinion, but even the console.log does not work :(
Here is the code (not complete):
bower.json

{
  "devDependencies": {
    "bootstrap": "~3.3.2",
    "jquery": "~2.1.3",
    "jquery-ui": "~1.11.2",
    "jquery-slimscroll": "~1.3.3",
    "font-awesome": "~4.3.0"
  }
}

Gruntfile.js
module.exports = function (grunt) {

    grunt.initConfig({

        bower_concat: {
            main: {
                cssDest: 'build/_bower.css',
                dest: 'build/_bower.js'
            }
        },

        concat_css: {
            main: {
                src: [
                    'build/_bower.css',
                    'css/*.css'
                ],
                dest: 'build/styles.css'
            }
        },

        concat: {
            main: {
                src: [
                    'build/_bower.js'
                    // 'js/*.js'
                ],
                dest: 'build/scripts.js'
            }
        }
    });
    require('load-grunt-tasks')(grunt);
    grunt.registerTask('default', [
        'bower_concat',
        'concat_css',
        'concat',
    ]);
};

package.json
{
  "main": "Gruntfile.js"
  },
  "devDependencies": {
    "grunt": "~0.4.5",
    "load-grunt-tasks": "~3.0.0",
    "grunt-concat-css": "~0.3.1",
    "grunt-bower-concat": "~0.4.0",
    "grunt-contrib-concat": "~0.5.0"
  }
}

upd:
My script:
console.log('1'); // выполняется (до вхождения в мой скрипт)
$(document).load(function () { // а вот сюда уже не попадает :(
console.log('2'); // не выполняется (после вхождения)

Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
aen, 2015-01-26
@slavikse

Here apparently it's not grunt'e. Try replacing $.load() with $.ready().
As far as I remember, $.load() has a status of deprecated.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question