locked
CSS and JS Deployment Best practices RRS feed

  • Question

  • We have 3 environments in our organization namely Dev,Stage and Production.  We do development on the Dev server . Our development involves many things including change in code on ASPX pages,master pages, CSS, JS etc. We have a deployment team which is supposed to deploy these changes to the STAGE and PROD environments. Right now the approach we take to deploy these changes is to manually edit each ASPX, CSS or JS file and enter the changes in it which is a lot of overhead for the deployment team. I feel this is not the proper way.

    Can anyone please suggest an optimum way of doing this work so that the deployment team requires minimum amount of manual intervention and all changes are deployed properly.

      

    Thursday, November 8, 2012 2:37 PM

Answers

  • Yes, with the Farm solution that deploys these files, you can make changes and redeploy and they will be updated on the server, with 2 things to note:

    1. If only changes to existing files are made, you can update the solution with the Update-SPSolution command in Powershell.
    2. If you are adding new files or deleting existing ones, you must uninstall and retract the solution, then redeploy.


    Brandon Atkinson
    Blog: http://brandonatkinson.blogspot.com
    Twitter: http://twitter.com/tehremo

    • Marked as answer by Jack-Gao Friday, November 16, 2012 9:44 AM
    Friday, November 9, 2012 3:40 PM

All replies

  • Fellow MVP Dave McMahon wrote a very nice article on how to deploy SharePoint customizations (which is what your aspx, CSS and JS is) using Features and Solutions.

    Start here:  http://www.simple-talk.com/content/print.aspx?article=1271


    I trust that answers your question...

    Thanks
    C

    http://www.cjvandyk.com/blog | LinkedIn | Facebook | Twitter | Quix Utilities for SharePoint | SharePoint Admin Nav Console (SPANC)

    Thursday, November 8, 2012 3:27 PM
    Answerer
  • Check this post as well for another solution: http://brandonatkinson.blogspot.com/2012/11/using-sharepoint-solutions-to-deploy.html

    I've used this in the past with success.  Basically you create a new project whose sole purpose is the deploy CSS and Scripts (or whatever) to the Layouts folder, then using Feature Dependencies make your other projects dependent on this feature being activated.  It allows you to have a single solution that can be deployed across all environments, and also allows your other code to target the layouts folder for these files by using relative paths (so you won't need to update your code between environments):

    <script type="text/javascript" src="/_layouts/MYCUSTOMSCRIPTFOLDER/jquery.js"></script>
    Since the layouts folder can be hit from any site, these relative paths make your life a lot easier.

    Brandon Atkinson
    Blog: http://brandonatkinson.blogspot.com

    Thursday, November 8, 2012 4:12 PM
  • Thanks, That is helpful. Can features and solutions be used to update existing CSS, JS files  e.g. If I already have a CSS file added and I want to add a few more classes to the same file. Can it be done using features? 
    Friday, November 9, 2012 2:12 PM
  • Yes, with the Farm solution that deploys these files, you can make changes and redeploy and they will be updated on the server, with 2 things to note:

    1. If only changes to existing files are made, you can update the solution with the Update-SPSolution command in Powershell.
    2. If you are adding new files or deleting existing ones, you must uninstall and retract the solution, then redeploy.


    Brandon Atkinson
    Blog: http://brandonatkinson.blogspot.com
    Twitter: http://twitter.com/tehremo

    • Marked as answer by Jack-Gao Friday, November 16, 2012 9:44 AM
    Friday, November 9, 2012 3:40 PM
  • Thanks Brandon for this valuable solutions.but i need more info about what's the command that make update in Powershell.

    Can i make script for update Styles only for the SP-Solution.

    Thank you in advance.

    Tuesday, June 18, 2013 3:03 PM