romanschejbal / gassetic

Assetic replacement based on the gulp build tool
MIT License
176 stars 17 forks source link

Replacements on prod doesn't work #51

Closed gerfigna closed 7 years ago

gerfigna commented 9 years ago

my template

{% if app.environment == 'prod' %}

<!-- prod:jquery.js --><!-- endbuild -->

<!-- prod:bootstrap.js --><!-- endbuild -->

<!-- prod:bootstrap-material-design.js --><!-- endbuild -->

<!-- prod:desktop.js --><!-- endbuild -->

{% else %}

<!-- dev:jquery.js -->
<script src="/tmp/js/jquery.js/jquery.min_0.js"></script>
<!-- endbuild -->

<!-- dev:bootstrap.js -->
<script src="/tmp/js/bootstrap.js/bootstrap.min_0.js"></script>
<!-- endbuild -->

<!-- dev:bootstrap-material-design.js -->
<script src="/tmp/js/bootstrap-material-design.js/material_0.js"></script>
<!-- endbuild -->

<!-- dev:desktop.js -->
<script src="/tmp/js/desktop.js/desktop_0.js"></script>
<script src="/tmp/js/desktop.js/Modal_1.js"></script>
<!-- endbuild -->

{% endif %}    

my gassetic.yml

requires:
    freeze: gulp-freeze
    concat: gulp-concat
    uglify: gulp-uglify
    minify: gulp-minify
    less:   gulp-less

mimetypes:

    images:
        prod:
            outputFolder: web/compiled/css/images
            tasks: []
            autoRenaming: false

        dev:
            outputFolder: web/tmp/css/images
            tasks: []
            autoRenaming: false

        files:
            desktop:
                - app/Resources/assets/desktop/images/*

    css:
        deps: 
            - "less"
            - "fonts"

        prod:
            outputFolder: web/compiled/css  # The output folder for your saving your compiled files
            webPath:      /compiled/css     # The web path for the compiled files
            # Run these tasks on your compiled files
            tasks:
                - { name: minify }
                - { name: concat, args: '%filename%' }

        # In 'dev' mode, use these settings
        dev:
            outputFolder: web/tmp/css  # The output files will be saved here
                                       #   (Add the tmp folder to gitignore so that your
                                       #   dev files aren't pushed to your repo)
            webPath:      /tmp/css     # The path used for the frontend
            # This is the list of tasks to run on the files
            # You can add gulp
            tasks: []
            autoRenaming: false        # turn off autorenaming for dev environment
        # In 'prod' mode, use these settings

        files:
            bootstrap.css:
                - bower_components/bootstrap/dist/css/bootstrap.css

            simple-line-icons.css:
                - bower_components/simple-line-icons/css/simple-line-icons.css

            foundation.css:
                - bower_components/foundation/css/foundation.css

            font-awesome.css:
                - bower_components/font-awesome/css/font-awesome.css 

            bootstrap-material-design.css:
                - bower_components/bootstrap-material-design/dist/css/material.min.css 

    less:

        prod:
            outputFolder: web/compiled/css  # The output folder for your saving your compiled files
            webPath:      /compiled/css     # The web path for the compiled files
            # Run these tasks on your compiled files
            tasks:
                - { name: less }
                - { name: minify }
                - { name: concat, args: '%filename%' }

        dev:
            outputFolder: web/tmp/css  # The output files will be saved here
                                       #   (Add the tmp folder to gitignore so that your
                                       #   dev files aren't pushed to your repo)
            webPath:      /tmp/css     # The path used for the frontend
            # This is the list of tasks to run on the files
            # You can add gulp
            tasks:
                - { name: less }
            autoRenaming: false        # turn off autorenaming for dev environment

        files:
            desktop.css:
                - app/Resources/assets/desktop/less/desktop.less
                - app/Resources/assets/desktop/css/Modal.css

    fonts:

        prod:
            outputFolder: web/compiled/css
            tasks: []
            autoRenaming: false

        dev:
            outputFolder: web/tmp/css
            tasks: []
            autoRenaming: false

        files:
            fonts:
                - bower_components/simple-line-icons/fonts/*
                - bower_components/font-awesome/fonts/*
                - bower_components/bootstrap-material-design/dist/fonts/*

    js:

        prod:
            outputFolder: web/compiled/js
            webPath:      /compiled/js
            tasks:
                # This task concats all the files into one
                - { name: concat, args: '%filename%' }
                # This task minifies the scripts
                - { name: uglify, args: { mangle: false } }
                # This is a cache busting gulp plugin that appends
                #  an md5 of the contents to the filename
                - { name: freeze }
            htmlTag: '<script type="text/javascript" src="{{ asset("%path%") }}"></script>'

        dev:
            outputFolder: web/tmp/js
            webPath:      /tmp/js
            tasks: []

        files:
            jquery.js:
                - bower_components/jquery/dist/jquery.min.js

            bootstrap.js:
                - bower_components/bootstrap/dist/js/bootstrap.min.js

            desktop.js:
                - app/Resources/assets/desktop/js/desktop.js   
                - app/Resources/assets/desktop/js/Modal.js

            foundation.js:
                - bower_components/foundation/js/foundation.js

            bootstrap-material-design.js:
                - bower_components/bootstrap-material-design/dist/js/material.js

replacementPaths:
    - app/Resources/views/*.html.twig
    - src/**/*.html.twig

default:
    - js
    - css
    - images

I have tried with

gassetic build --env=prod
gassetic --env=prod
gassetic
...

it process the files properly, but doesn't replace the build tags on template.

romanschejbal commented 9 years ago

Could you post the output of the gassetic build --env prod as well pls?

gerfigna commented 9 years ago

yes, thanks for the response !

[14:01:56] Processing: js with concat("%filename%"), uglify({"mangle":false}), freeze()
[14:01:56]  - jquery.js
[14:01:56]  - bootstrap.js
[14:01:56]  - desktop.js
[14:01:56]  - foundation.js
[14:01:56]  - bootstrap-material-design.js
[14:01:56] Processing: less with plumber(), less(), minify(), concat("%filename%")
[14:01:56]  - desktop.css
[14:01:56] Processing: fonts with 
[14:01:56]  - fonts
[14:01:56] Processing: images with 
[14:01:56]  - desktop
[14:01:56] Tested 2 tests, 2 passes, 0 failures: PASS
[14:01:59] Tested 2 tests, 2 passes, 0 failures: PASS
[14:01:59] Tested 2 tests, 2 passes, 0 failures: PASS
[14:02:01] Tested 2 tests, 2 passes, 0 failures: PASS
[14:02:01] Tested 3 tests, 3 passes, 0 failures: PASS
[14:02:01] Tested 3 tests, 3 passes, 0 failures: PASS
[14:02:02] Tested 4 tests, 4 passes, 0 failures: PASS
[14:02:02] Tested 24 tests, 24 passes, 0 failures: PASS

I'm working on Mac OS 10.10, Case sensitive filesystem (I have added the plumber task right now)

r0b- commented 9 years ago

Same problem here :-( Do you have a solution?

Thanks

r0b- commented 9 years ago

Ok I tracked my problem down to a del task that screws up the processing and the replacement (that happens at the build end) gets skipped.

romanschejbal commented 7 years ago

The new version has a proper error handling so I'm closing this since I think it was just a swallowed error. Feel free to reopen this issue if it's still happening. Thanks