diff --git a/gulpfile.js b/gulpfile.js index f82646c..7512b4c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -12,6 +12,10 @@ const paths = { all: 'src/templates/**/*.html' }, + img: { + all: 'src/assets/*.png', + }, + styles: { all: 'src/styles/**/*.scss', main: 'src/styles/main.scss', @@ -26,19 +30,17 @@ const paths = { }; function html () { - return src(paths.html.all,).pipe(dest(paths.output)); + return src(paths.html.all).pipe(dest(paths.output)); } - function styles() { return src(paths.styles.main).pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError)).pipe(dest(paths.output)); - }; function server () { connect.server({ - root: paths.output, + root: 'dist', livereload: true, port: 3000, }) @@ -48,10 +50,16 @@ function styles() { watch(paths.html.all, {ignoreInitial: false}, html); watch(paths.styles.all, {ignoreInitial: false}, styles); watch(paths.scripts.all, {ignoreInitial: false}, scripts); + watch(paths.img.all, {ignoreInitial: false}, img); } function scripts () { return browserify(paths.scripts.main).transform(Babelify.configure({presets: ['@babel/preset-env'],})).bundle().pipe(source('bundle.js')).pipe(buffer()).pipe(uglify()).pipe(dest(paths.output)); } + + function img () { + return src(paths.img.all).pipe(dest(paths.output)); + } + exports.default = parallel (server, sentinel); diff --git a/src/scripts/components/TouristAttractions.js b/src/scripts/components/TouristAttractions.js index 28b7a42..4ae6b01 100644 --- a/src/scripts/components/TouristAttractions.js +++ b/src/scripts/components/TouristAttractions.js @@ -71,7 +71,7 @@ export class TouristAttractions { addProperty (e) { e.preventDefault(); - const spotImg = this.labelInput.querySelector('.img-result'); + const spotImg = this.labelInput.children[0].src const spotTitle = e.target['input-title'].value const spotDescription = e.target['input-description'].value @@ -79,7 +79,7 @@ export class TouristAttractions { if (this.spotImg != '' && spotTitle != '' && spotDescription != '') { const spot = { - image: spotImg.src, + image: spotImg, titulo: spotTitle, description: spotDescription, }; @@ -97,8 +97,6 @@ export class TouristAttractions { }; - - renderListItems () { let spotStructure = ''; @@ -110,7 +108,7 @@ export class TouristAttractions { Imagem Turismo -
+
S

${i.titulo}

@@ -135,4 +133,5 @@ export class TouristAttractions { this.labelInput.style.border = ""; }; + } diff --git a/src/templates/index.html b/src/templates/index.html index 26bed95..3dab504 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -21,7 +21,7 @@ - +
@@ -44,19 +44,14 @@
-
-
    - -
    - -
    - + + +