So here's the situation. I currently have project with the following folder structure:
-- public_html
-- assets
-- scss (contains SCSS files, which can be located inside subfolders)
-- scripts
-- vendor
-- plugins (Also contain some SCSS files from the)
-- css
-- also some other folders (no scss or css here though)
-- dist (distribution folder)
-- other folders too for html, php etc...
When I want to upload the script to my remote server, I firstly process the complete folder structure in public_html
to the dist
. I do this with a build script, build.sh
, which you can see here:
function prepareForBuild(){
echo "Updating dependencies...";
bower install
echo "Preparing 'dist' directory...";
mkdir -p dist
rm -rf dist/*
# for the stackoverflow markup... */
}
function buildApp(){
cd assets
echo "Creating temp directory..."
mkDir -p temp
## MERGING TAKES (OR SHOULD) PLACE HERE
find "/" -name '*.scss' -exec cat {} \; > merge.scss
cd ../
pause
# requirejs optimization
echo "Optimizing files...";
node r.js -o build/build.js
}
function cleanup(){
echo "Cleaning up unnecessary files...";
cd dist
rm -f bower.json .gitignore .bowerrc README.md .DS_Store config.rb
rm -f build.sh build.txt composer.json composer.lock
rm -rf build dist scss .git .sass-cache .idea
}
function pause(){
read -p "$*"
}
prepareForBuild
buildApp && cleanup
echo "Building finished!";
Problem:
However, when I run the script in the Git bash terminal it breaks at this line:
find "/" -name '*.scss' -exec cat {} \; > merge.scss
Edit: "/" or "\" does not seem to affect the problem :(
Also, run from root (public_html) directory:
where it returns in the normal command prompt "File not found - *.scss" (and outputs an empty merge.scss file) and simply stops working in the Git bash terminal. I based this line on this answer, but I can't get it to work for me. I also tried something like this instead but this only returns more errors. What am I missing here?
EDIT!
I thought the bash shell simply stopped working but it seems that was not the case. After a while it returns this:
What does this mean? Is the reference folder incorrect?
Objective:
As said I would like to recursively scan the assets folder for .scss
files and merge them into one default.scss
.
If this is too much to ask another solution integrated with require.js
(or simply with node) would also be possible, as you can see in my script I already use require.js
for standard optimization.
Thanks for your time and patience!