0

This applies to Drupal 7.

I am fairly new to grunt and can't really make much sense of out of a gruntfile. I've just started with a drupal child theme (which has been created off bootstrap SASS startkit).

Can you point out a readymade grunt file which I can use to watch and compile my scss (output as css) and minify js.

closed as off-topic by Clive Feb 22 '17 at 12:53

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking to recommend or find a book, tool, module, theme, distribution, tutorial, or other off-site resource are off-topic for Drupal Answers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Clive
If this question can be reworded to fit the rules in the help center, please edit the question.

1
module.exports = function(grunt) {
grunt.initConfig({
compass: {
 dist: {
    options: {
      sassDir: 'sass',
      cssDir: 'css',
      environment: 'production',
    },
  },
},
watch: {
  css: {
    files: ['sass/*.scss'],
    tasks: ['compass'],
  },
},
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.registerTask('default', ['compass']);
};
  • Just saw it here. You might like this package for the JS part, npmjs.com/package/grunt-contrib-uglify – rovr138 Feb 20 '17 at 16:47
  • Absolutely, the js part is also very nicely explained in the official doc, but this one is also equally helpful. Thanks. – oli-chowdhury Feb 20 '17 at 23:24
0

Not sure if this is a Drupal subtheme, but an alternative is looking into the Drupal Bootstrap theme and checking out the grunt configuration they have.

  • Thanks for pointing this out ( I wasn't aware it existed!) but it seems like an overkill. I've figured out how to use a custom grunt file which works irrespective of drupal or non-drupal site. And the official documentation -gruntjs.com/sample-gruntfile was massively helpful in this case. Happy to post back my discovery. – oli-chowdhury Feb 20 '17 at 16:00
  • That's great! An answer with your file would be a nice addition – rovr138 Feb 20 '17 at 16:45
  • I've posted my answer above. – oli-chowdhury Feb 20 '17 at 23:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.