Skip to content
Permalink
Browse files

Closes #180 - moves compiled files into a new directory

  • Loading branch information...
codewithkyle committed Jun 21, 2019
1 parent 47eff1c commit bc452d5a6a07192f9191f611e786bb9cdaa5e652

This file was deleted.

@@ -5,11 +5,8 @@
/node_modules

# Assets
/public/assets/
!/public/assets/fonts
!/public/assets/images
!/public/assets/polyfills
!/public/assets/videos
/public/automation/*
!/public/automation/.gitkeep

# Craft CMS
# -------
@@ -3,6 +3,12 @@
### Added

- Adds: reset CSS to `base.twig` `<head>` [#181](https://github.com/Pageworks/papertrain/issues/181)
- Adds: `page.twig` layout for templates
- Adds: `public/automation/` directory due to gitignore issues with the assets directory [#180](https://github.com/Pageworks/papertrain/issues/180)

### Removed

- Removes: `.editorconfig` file

## 0.2.1 - 2010-06-17

@@ -24,7 +24,7 @@ function compileSASS(){
console.log(chalk.white('Compiling SASS'));

// Make the new CSS directory
fs.mkdirSync(`./public/assets/styles-${ timestamp }`);
fs.mkdirSync(`./public/automation/styles-${ timestamp }`);

// Generate the files
for(let i = 0; i < files.length; i++){
@@ -41,7 +41,7 @@ function compileSASS(){
}else{
const fileName = result.stats.entry.match(/[ \w-]+?(?=\.)/gi)[0].toLowerCase();
if(fileName){
const newFile = `./public/assets/styles-${ timestamp }/` + fileName + '.css';
const newFile = `./public/automation/styles-${ timestamp }/` + fileName + '.css';
console.log(chalk.hex('#ffffff').bold(file), chalk.hex('#8cf57b').bold(' [compiled]'));
cleanup(files.indexOf(file));
fs.writeFile(newFile, result.css.toString(), function (err) {
@@ -71,7 +71,7 @@ function cleanup(index){

console.log(chalk.white('Removing stale CSS'));

const path = `public/assets`;
const path = `public/automation`;
const allDirs = fs.readdirSync(path);
const styleDirs = [];
for(let i = 0; i < allDirs.length; i++){
@@ -84,7 +84,7 @@ function cleanup(index){
const directoryTimestamp = styleDirs[i].match(/[^styles-].*/)[0];

if(parseInt(directoryTimestamp) < parseInt(timestamp)){
rimraf(`public/assets/${ styleDirs[i] }`, (err)=>{
rimraf(`public/automation/${ styleDirs[i] }`, (err)=>{
if(err){
console.log(`Failed to remove ${ styleDirs[i] }`);
throw err;
@@ -29,9 +29,9 @@ class PapertrainModuleService extends Component
public function buildAssetPaths(array $twigNames)
{
$ret = array();
$modulesBasePath = \Craft::getAlias('@rootUrl').'/assets/modules-' . Craft::$app->config->general->jsCacheBustTimestamp . '/';
$packagesBasePath = \Craft::getAlias('@rootUrl').'/assets/packages-' . Craft::$app->config->general->jsCacheBustTimestamp . '/';
$stylesBasePath = \Craft::getAlias('@rootUrl').'/assets/styles-' . Craft::$app->config->general->cssCacheBustTimestamp . '/';
$modulesBasePath = \Craft::getAlias('@rootUrl').'/automation/modules-' . Craft::$app->config->general->jsCacheBustTimestamp . '/';
$packagesBasePath = \Craft::getAlias('@rootUrl').'/automation/packages-' . Craft::$app->config->general->jsCacheBustTimestamp . '/';
$stylesBasePath = \Craft::getAlias('@rootUrl').'/automation/styles-' . Craft::$app->config->general->cssCacheBustTimestamp . '/';
foreach ($twigNames as $twigName){
$kebabCaseName = StringHelper::toKebabCase($twigName);
$finalName = StringHelper::toLowerCase($kebabCaseName);
No changes.
@@ -27,7 +27,7 @@ module.exports = {
mode: (process.env.NODE_ENV === 'production') ? 'production' : 'none',
entry: entries,
output: {
path: path.resolve(__dirname, './public/assets'),
path: path.resolve(__dirname, './public/automation'),
filename: `modules-${ timestamp }/[name].js`
},
resolve:{
@@ -92,7 +92,7 @@ module.exports = {
function cleanup(){
console.log(chalk.white('Removing stale JavaScript builds'));

const path = `public/assets`;
const path = `public/automation`;
const allDirs = fs.readdirSync(path);

const moduleDirs = [];
@@ -106,7 +106,7 @@ function cleanup(){
const modulesTimestamp = moduleDirs[i].match(/[^modules-].*/)[0];

if(parseInt(modulesTimestamp) < parseInt(timestamp)){
rimraf(`public/assets/${ moduleDirs[i] }`, (err)=>{
rimraf(`public/automation/${ moduleDirs[i] }`, (err)=>{
if(err){
console.log(`Failed to remove ${ moduleDirs[i] }`);
throw err;
@@ -126,7 +126,7 @@ function cleanup(){
const packageTimestamp = packageDirs[i].match(/[^packages-].*/)[0];

if(parseInt(packageTimestamp) < parseInt(timestamp)){
rimraf(`public/assets/${ packageDirs[i] }`, (err)=>{
rimraf(`public/automation/${ packageDirs[i] }`, (err)=>{
if(err){
console.log(`Failed to remove ${ packageDirs[i] }`);
throw err;

0 comments on commit bc452d5

Please sign in to comment.
You can’t perform that action at this time.