tactivos / grunt-cdn

79 stars 53 forks source link

Support for jade templates #50

Open imrane opened 10 years ago

imrane commented 10 years ago

Didn't see this in the list of supported types...

bumbu commented 8 years ago

You can add it to options as supportedTypes: { 'jade': 'html' }

naoyeye commented 8 years ago

thanks @bumbu , I added supportedTypes: { 'jade': 'html' }, but still not work.

then I modified jade file: link(rel='stylesheet', href='/stylesheets/preview.css') replace with: | <link rel="stylesheet" href="/stylesheets/preview.css">

it's not the best solution but worked successfully for me.

naoyeye commented 8 years ago

The solution above-mentioned not available for this case:

 <!-- build:js /javascripts/preview.pack.js -->
script(src='/bower_components/zepto/zepto.js')
script(src='/bower_components/fastclick/lib/fastclick.js')
script(src='/javascripts/preview.js')
<!-- endbuild -->

so sad. I gave up and defected to string-replace https://github.com/eruizdechavez/grunt-string-replace

'imagesCDN-staging': {
    files: [{
        '<%= paths.dist %>/stylesheets/': '<%= paths.dist %>/stylesheets/*.css'
    }, {
        '<%= paths.dist %>/views/': '<%= paths.dist %>/views/*.jade'
    }],
    options: {
        replacements: [{
            pattern: /\/images\//gi,
            replacement: '//xxxxx.amazonaws.com/xxxxxx/xxxxxx/images/'
        }]
    }
},
'sourcePathInJade-staging': {
    files: [
        {'<%= paths.dist %>/views/': '<%= paths.dist %>/views/*.jade'}
    ],
    options: {
        replacements: [{
            pattern: /\/stylesheets\//gi,
            replacement: '//xxxxx.amazonaws.com/xxxxxx/xxxxxx//stylesheets/'
        }, {
            pattern: /src=\'\/javascripts\//gi,
            replacement: 'src=\'//xxxxx.amazonaws.com/xxxxxx/xxxxxx/javascripts/'
        }]
    }
},