Skip to content

Instantly share code, notes, and snippets.

@radovansurlak
Last active September 22, 2017 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radovansurlak/baf327d290ed1bcbe878d22bb375ea9e to your computer and use it in GitHub Desktop.
Save radovansurlak/baf327d290ed1bcbe878d22bb375ea9e to your computer and use it in GitHub Desktop.

Faster Compass Hack

  1. Create a folder source\scss\compiled-custom
  2. Move custom.template.scss to source\scss\compiled-custom
  3. Run "npm install jit-grunt --save-dev"
  4. Run "npm install grunt-string-replace --save-dev"
  5. Copy "config.rb" to the root
  6. Replace the code in "gruntfile.js"
  7. Run "compass watch"
  8. Run "grunt sass"
require 'compass/import-once/activate'
require 'breakpoint'
require 'breakpoint-slicer'
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "assets/css"
sass_dir = "source/scss/compiled-custom"
# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
# To disable debugging comments that display the original location of your selectors. Uncomment:
# line_comments = false
# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
module.exports = function(grunt) {
require('time-grunt')(grunt);
require('jit-grunt')(grunt);
grunt.initConfig({
watch: {
options: {
atBegin: true
},
sass: {
files: './source/scss/**/*.{scss,sass}',
tasks: ['compass:build']
},
turboSass: {
files: './source/scss/custom/**/*.{scss,sass}',
tasks: ['string-replace']
},
js: {
files: './source/**/*.js',
tasks: ['uglify:watch']
}
},
'string-replace': {
inline: {
files: {
'source/scss/compiled-custom/': 'source/scss/compiled-custom/custom.template.scss',
},
options: {
replacements: [
{
pattern: '@',
replacement: '@'
}
]
}
}
},
compass: {
options: {
require: ['breakpoint', 'breakpoint-slicer'],
sassDir: 'source/scss',
cssDir: 'assets/css',
imagesDir: 'assets/images',
specify: ['source/scss/custom.template.scss'],
relativeAssets: true,
noLineComments: true,
bundleExec: true
},
watch: {
options: {
environment: 'development',
noLineComments: false
}
},
build: {
options: {
outputStyle: 'compact',
environment: 'production',
noLineComments: true
}
}
},
uglify: {
watch: {
files: {
'assets/js/custom.js': ['./source/js/custom/**/*.js'],
},
options: {
compress: false,
mangle: false,
beautify: true
}
},
build: {
files: {
'assets/js/custom.js': ['./source/js/custom/**/*.js']
},
options: {
sourceMap: true,
preserveComments: false,
mangle: true,
compress: {
drop_console: true
}
}
}
}
});
grunt.registerTask('default', ['watch']);
grunt.registerTask('sass', ['watch:turboSass']);
grunt.registerTask('libs', ['uglify:build']);
grunt.registerTask('build', ['compass:build', 'libs']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment