0

I have the following setup in my Grunt file for css

cssmin: {
        options: {
            rebase: true,
        },
        concat: {
            files: {
                'dist/app.css': [
                    'tmp/*.css',
                    'app/theme/css/vendors/fontello.css',
                    'app/theme/js/vendors/revolution/css/settings.css',
                    'app/theme/css/styles.css',
                    'app/theme/css/media-queries.css',
                    'app/app.css'
                ]
            }
        },
        min: {
            files: [{
                src: 'dist/app.css',
                dest: 'dist/app.css'
            }]
        }
    },

It works great except one tiny issue. The paths are rebased to start with 'app/theme/...' or 'app/images/...' however all my files are moved into a dist folder for uploading to production. Instead I want it to generate paths such as '/theme/...' or '/images/...'

Ben_hawk
  • 2,476
  • 7
  • 34
  • 59
  • are you using grunt-usemin? Usemin replaces references for you. – Tony Barnes Mar 19 '15 at 17:46
  • Yep, this one to be exact: https://github.com/gruntjs/grunt-contrib-cssmin – Ben_hawk Mar 19 '15 at 17:47
  • No, that's cssmin, not usemin: https://github.com/yeoman/grunt-usemin – Tony Barnes Mar 19 '15 at 17:49
  • Consider using Less. Without changing the files (aside from the file extension), you can create proper CSS files with all of the imports resolved. Also, it gives you extra features to CSS (like variables and the such) should you want. – Madara's Ghost Mar 19 '15 at 17:53
  • That wont help my 3rd party libraries though :(, im sure this must be a simple option to resolve – Ben_hawk Mar 19 '15 at 17:55
  • You could use grunt-usemin as i've already mentioned. It would also be beneficial (regardless of using usemin or not), to use a CSS preprocessor like Sass, or Less. – Tony Barnes Mar 19 '15 at 17:58
  • Seems like its just as difficult to do what i want – Ben_hawk Mar 19 '15 at 19:32
  • Ben, you can easily achieve exactly what you want by using sass, less or grunt-usemin. Why don't you give one of them a try? – Tony Barnes Mar 19 '15 at 20:05

0 Answers0