Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Up and Running with Grunt

Marc Murray
Marc Murray
4,618 Points

SCSS won't compile

The plugins installed successfully, and the other tasks are running fine. Am I maybe selecting the wrong files? No files are getting generated. When I run grunt I get the following:

    Done, without errors.
    MacBook-Pro:portfolio-grunt marcmurray$ grunt
    Running "uglify:dev" (uglify) task 
    >> 1 file created.

    Running "sass:dev" (sass) task

My gruntfile:

    module.exports = function(grunt) {

    // Configure tasks
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        uglify: {
            dev: {
                options: {
                    beautify: true,
                    mangle: false,
                    compress: false,
                    preserveComments: 'all'
                },
                src: 'src/js/*.js',
                dest: 'js/script.min.js'
            },
            build: {
                src: 'src/js/*.js',
                dest: 'js/script.min.js'
            }

        },
        sass: {
            dev: {
                options: {
                    outputStyle: 'expanded'
                }
            },
            files: {
                'src/lad.css': 'src/sass/style.scss'
            }
        },
        watch: {
            js: {
                files: 'src/js/*.js',
                tasks: ['uglify:dev']
            }
        }
    });

    // Load the plugins
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-sass');

    // Register tasks

    // To run these tasks, just type grunt
    grunt.registerTask('default', ['uglify:dev','sass:dev']);
    // To trigger tasks here, type grunt build, this says when build project, minify everything.
    grunt.registerTask('build', ['uglify:build']);
    // You can make whatever ones you want, normally a good idea to split into     development tasks and production tasks.
};

Would appreciate some help, love to get this into my workflow!

David Graham
David Graham
Courses Plus Student 743 Points

Hi,

I had the same problem, changing outputStyle to 'compressed' in the build options sorted this for me..

Hope this helps.. :)

ps. Check the vid at around 52.14