Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filename convention not up to date? #2

Closed
monbro opened this issue Nov 2, 2013 · 9 comments
Closed

Filename convention not up to date? #2

monbro opened this issue Nov 2, 2013 · 9 comments

Comments

@monbro
Copy link

monbro commented Nov 2, 2013

Hey,

when I am trying to deploy to parseapp I am getting this error:

Malformed response {u'code': 122, u'error': u'Bad file name: app/scripts/modules/data/_ParseObjects.js'} when trying to upload app/scripts/modules/data/_ParseObjects.js

According to https://parse.com/docs/cloud_code_guide#hosting-uploading

  • Filenames should begin with an alphanumeric character and consist only of alphanumeric characters, dashes, underscores, spaces, and '@' signs.

so they should not start with a underscore?

@spacenick
Copy link
Contributor

Oh, interesting. Basically we never upload our files like that because we use Grunt to concat them and uglify them, so the final outptut is just one javascript file (that doesn't start with a special character in that case); that's why this error never happened to us.

Good point, I guess you're free to rename it if you don't want to build the project and upload the original files. On my side I'd still encourage people to upload built projects to Parse (deploy is faster etc etc) and use your local Grunt server to test / source maps to debug in prod.

Thanks for your feedback!

@monbro
Copy link
Author

monbro commented Nov 2, 2013

Alright thank you for the quick response. Maybe I am a retard, but the command grunt build
is not uglifying the files for me inside the build folder, what am I missing?

@spacenick
Copy link
Contributor

You have to use grunt optimize after grunt build to obtain a complete production-ready build! build and optimize are two separate tasks because we still need to have "plain" JS file when we develop on local machines

@monbro
Copy link
Author

monbro commented Nov 2, 2013

Thank you! Thats it! One thing left, I still got the plain JS files in my build folder. How do I get rid of them (in the build folder) and without changing the path`s in my index.html etc. manually?

@monbro
Copy link
Author

monbro commented Nov 2, 2013

Ah sorry, I see grunt changed the files in the index.html. So the only thing is how do I delete the plain files from my build folder?

@spacenick
Copy link
Contributor

Yep it's true that they're all still present even if we have a build file; if that is really a problem and you'd rather have a folder containing only the minified script (actually that's a good idea) I guess I would use the clean task with a special pattern saying like : remove all *.js file except build.js or something.

But be careful, only clean all files when deploying your project, because when you use grunt server, your app is expecting the plain JS file (as in your index.html); cleaning should be only reserved for final deployment of the built app

You can give an eye here https://github.com/gruntjs/grunt-contrib-clean

From http://stackoverflow.com/questions/12632029/grunt-minimatch-glob-folder-exclusion you can add a target to the clean task with that kind of pattern :

clean:
    build:          '<%= BUILD_DIR %>' 
        # notice the ! before the second element of the array
    production:  ['client/app/scripts/**/*.js', '!client/app/scripts/*.build.js']

And then add the clean task in the optimize one at the end

grunt.registerTask('optimize', [ 'useminPrepare', 'concat', 'replace:dist', 'ngmin', 'copy:sourceMap', 'uglify' ,'cssmin', 'rev:css', 'rev-replace', 'usemin', 'clean:production'])

@monbro
Copy link
Author

monbro commented Nov 2, 2013

Thanks man! Helps very much!

@spacenick
Copy link
Contributor

No worries dude

@piyush123
Copy link

Hey nick. Somewhat related but just to be clear do you recommend a workflow thats , grunt server for local development, using the server directory . Then having a separate deploy directory to copy the minified/js css, index.html into. Then doing a parse deploy. That is what I am currently doing but now that we are doing some Cloud code and Oauth for Twitter API , I am trying to organize things so its efficient for local development and testing. So I am wondering do I need to keep a separate Server and Deploy directory ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants