I'm looking for a more efficient way to deploy my WordPress themes. Right now I create the theme and when finished I copy the contents into a new folder without all my Node, Grunt and other dev files. My dev environment runs on DesktopServer, which has an auto-deploy option, but this also copies unwanted dev files.
Could I use Grunt to create a task that when fired copies specific files and folders from /themes/dev-theme/ to /themes/production-ready-theme/ ? This way I have a clean theme that can easily be zipped or uploaded to the production server.
Update: I just thought of a possible solution to run grunt-contrib-copy from my themes directory. This Grunt module would let me control which files to copy. But perhaps there is a more clean or efficient method to accomplish this task.
By using the Grunt Shell module you could simply add this to your grunt file:
grunt.initConfig({
shell: {
moveTemlates: {
command: 'mv /themes/dev-theme/* /themes/production-ready-theme/'
}
}
});
The grunt-contrib-copy module does have the possibility to copy files up the directory tree after all. I just tried it out using these setting in my grunt.js file and it worked.
Grunt Shell gets the job done. But if you already have grunt-contrib-copy installed in your project you could just use this.
copy: {
main: {
src: ['css/*', 'img/*', 'icons/*', 'js/*', 'lang/*', 'lib/*', '*.php', '*.css'],
dest: '../production-theme/'
}
},
Related
I would like to copy the content of my 'three-experience' folder into the current "bin execution environment".
I'm using Typescript, but there is no issue with it at the moment (and I'm mapping on the .js dist files).
I have the following root:
My package.json is mapping in the dist folder like so :
"bin": {
"ts-cli": "dist/main.js",
"vite-config": "dist/bin/vite-config.js"
},
During the execution I'm calling the "vite-config" bin (using shelljs):
shell.exec('vite-config');
It may not be clear but the purpose is to do a npm package that would install a template on your local machine.
I can do it with git. But that's not what I want to do.
I thought about filling a process.env.FOLDER global variable, but I am quite sure that's a bad idea.
Any clue would be appreciated !
I'm setting up a gulp build file for a node.js project and I really don't have any experience with either of them.
So basically what I'm doing is simply copying all the code to a deployment directory, but I'm unsure of how to handle all the dependencies that are stored in node_modules. Do you simply copy all of them as well, or is there a more preferred way of doing it?
gulp.task('deliver', function() {
gulp.src('src/*.html').pipe(gulp.dest('deployment/'));
gulp.src('src/*.js').pipe(gulp.dest('deployment/'));
gulp.src('src/games/').pipe(gulp.dest('deployment/'));
});
The standard way would be to have a package.json file that lists all your dependencies. Then as part of your deployment process run npm install which will go through your package.json and install any necessary packages in the node_modules folder.
I installed jquery-ui using npm. How can I copy node_modules/jquery-ui/themes/.../images/*.png to public/images directory in Brunch build? I do not want to manually copy files under assets/
after-brunch plug-in does the trick. You can execute arbitrary cmd commands after the build using this plug-in. Many thanks to Creative-Licence-Digital...
Or, you can create a symbolic link from node_modules to app/assets.
I'm wanting to add a directory of files to my SASS processing in my "dev" task, or alternatively exclude it in a "build" task. Any tips for doing this well?
In a nutshell there is some css I don't want to include in the build.
You can try to use grunt-copy task in the your dev task.
for example you have the following structure of your styles:
/styles
/dev-scss
/scss
/main
/dev
The idea is to copy the content of the "dev-scss" folder into "dev" folder only for dev grunt task.
There is only some problem, you have to clear dev folder for every other task.
I am using VIM as my text editor and Yeoman to help me with my webapp development workflow.
I am already using vim-jshint to help me lint my javascript files from within VIM and I would like to use it in sync with my Yeoman setup.
My problem is that every time I run grunt, the jshint task founds lots of errors that vim-jshint couldn't find.
I am aware vim-jshint looks for a .jshintrc file in two possible paths: the HOME path and the current working directory but, in its current state of development, vim-jshint seems to be unable to find the .jshintrc that Yeoman uses, which is located in the base directory of the webapp.
Has any of you found a solution or workaround for this?
Please, switching to Sublime Text is not an option.
Got it! I was using the wrong vim-jshint plugin.
I should have used the one that's listed in JSHint's site from the beginning, but somehow I was misled to the wrong plugins. Stupid me.
Finally, having pathogen.vim installed, I just had to copy and paste this:
cd ~/.vim/bundle
git clone git://github.com/walm/jshint.vim
As stated in its own github README file, This plugin is a front for the jshint NodeJS cli module which ensures that running :JSHint inside VIM will always report the same errors as grunt's jshint task. At least if you run VIM from the same folder where JSHint's options file (.jshintrc) is located.